Friday, December 5, 2025

Git & GitHub Interview Questions & Answers


 


Git & GitHub Interview Questions & Answers 🧑‍💻🌐  


1️⃣ What is Git?  

A: Git is a distributed version control system to track changes in source code during development.


2️⃣ What is GitHub?  

A: GitHub is a cloud-based platform that hosts Git repositories and supports collaboration, issue tracking, and CI/CD.


3️⃣ Git vs GitHub  

•  Git: Version control tool (local)  

•  GitHub: Hosting service for Git repositories (cloud-based)  


4️⃣ What is a Repository (Repo)?  

A: A storage space where your project’s files and history are saved.


5️⃣ Common Git Commands:  

•   git init  Initialize a repo  

•   git clone  Copy a repo  

•   git add  Stage changes  

•   git commit  Save changes  

•   git push  Upload to remote  

•   git pull  Fetch and merge from remote  

•   git status  Check current state  

•   git log  View commit history  


6️⃣ What is a Commit?  

A: A snapshot of your changes. Each commit has a unique ID (hash) and message.


7️⃣ What is a Branch?  

A: A separate line of development. The default branch is usually  main  or  master .


8️⃣ What is Merging?  

A: Combining changes from one branch into another.


9️⃣ What is a Pull Request (PR)?

A: A GitHub feature to propose changes, request reviews, and merge code into the main branch.


🔟 What is Forking?  

A: Creating a personal copy of someone else’s repo to make changes independently.


1️⃣1️⃣ What is .gitignore?  

A: A file that tells Git which files/folders to ignore (e.g., logs, temp files, env variables).


1️⃣2️⃣ What is Staging Area?  

A: A space where changes are held before committing.


1️⃣3️⃣ Difference between Merge and Rebase  

•  Merge: Keeps all history, creates a merge commit  

•  Rebase: Rewrites history, makes it linear  


1️⃣4️⃣ What is Git Workflow?  

A: A set of rules like Git Flow, GitHub Flow, etc., for how teams manage branches and releases.


1️⃣5️⃣ How to Resolve Merge Conflicts?  

A: Manually edit the conflicted files, mark resolved, then commit the changes.

Best AI Tool for Software Developer - SD 1,2,3,4,5,6.......


Git & GitHub Interview Questions & Answers

  Git & GitHub Interview Questions & Answers 🧑‍💻🌐   1️⃣ What is Git?   A: Git is a distributed version control system to track ...