Git Interview Questions 2026, 35 Q&A on Branching, Merge vs Rebase, and Recovery

What changed in 2026 drives
Mass-recruiter offer letters are flatter for 2026 batch - the 4-5 LPA ASE band has barely budged in three years while inflation eats real wages. Premium tracks (Digital, Pro, Elite, Specialist) are still where the differential lives, and they are entirely test-driven. If you are aiming higher than the default offer, the coding round is not optional pageantry - it is the entire interview.
What I'd actually study for this
- 01Two solid coding-round answers (1 medium-hard DSA each, with edge-case discussion) > five half-baked ones
- 02One real project you can defend end-to-end - file paths, design decisions, and what you would change
- 03One DBMS schema you actually built (not a textbook ER diagram), with at least 3 join-heavy queries written from memory
- 04Three behavioural STAR stories: failure recovered, conflict handled, ownership taken
Where most candidates trip up
The single biggest mistake is treating company-specific guides as primary prep and DSA as secondary. It is the opposite. Mass recruiters use the test as a filter, but premium tracks at every IT services company use coding to allocate offer band. Spend 70% of prep time on DSA + system fundamentals, 20% on company-specific patterns, 10% on HR rehearsal. Reverse that ratio and you collect the default offer.
Editorial commentary by Aditya Sharma · written for PapersAdda · not generated, not aggregated.
Git fluency is assumed in 2026, and candidates report interviewers probe the parts people fake: rebase, reset vs revert, and recovery. Beyond add and commit, the questions test your mental model of commits, branches, and history. This guide compiles 35 questions from candidate-reported rounds and public preparation resources, each with commands and the trade-off being tested.
The mental model: a branch is just a movable pointer to a commit, and a commit is an immutable snapshot. Most Git confusion dissolves once this clicks.
Related: CI CD Interview Questions 2026 | Docker Scenario Based Questions 2026 | REST API Interview Questions 2026 | Node.js Interview Questions 2026
Fundamentals (Q1 to Q12)
Q1. What is the difference between Git and GitHub?
Q2. What are the three states of a file in Git?
Q3. What is the difference between git fetch and git pull?
Q4. What is a branch in Git?
Q5. What is HEAD?
Q6. What is the difference between git merge and git rebase?
| Merge | Rebase | |
|---|---|---|
| History | Preserves, adds a merge commit | Linear, replays commits |
| Result | Non-linear graph | Clean straight line |
| Shared branches | Safe | Avoid (rewrites history) |
| Use | Integrating feature branches | Tidying local commits before pushing |
Candidate-reported as the single most common Git question. The key: never rebase commits others have pulled.
Q7. Why should you not rebase a shared/public branch?
Q8. What is the difference between git reset and git revert?
| reset | revert | |
|---|---|---|
| Action | Moves the branch pointer back | Creates a new commit undoing changes |
| History | Rewrites it | Preserves it |
| Shared branches | Dangerous | Safe |
Use revert to undo on shared branches; reset for local cleanup. Candidate-reported as a top question.
Q9. What are the three modes of git reset?
Q10. What is git stash?
Q11. What is the difference between git stash pop and apply?
Q12. What does git cherry-pick do?
Conflicts, History, and Recovery (Q13 to Q24)
Q13. How do you resolve a merge conflict?
Q14. How do you recover a deleted commit or branch?
Q15. What is git reflog?
Q16. How do you undo the last commit but keep the changes?
Q17. How do you amend the last commit?
Q18. What is an interactive rebase used for?
Q19. What is the difference between a fast-forward and a three-way merge?
Q20. How do you squash commits?
Q21. How do you find which commit introduced a bug?
Q22. How do you see who changed a line and when?
Q23. What is the difference between git diff, git diff --staged, and git diff HEAD?
Q24. How do you remove a file from Git but keep it locally?
Workflows and Best Practices (Q25 to Q35)
Q25. What is the difference between centralized, feature-branch, Gitflow, and trunk-based workflows?
Q26. What is a pull request and why use it?
Q27. What makes a good commit message?
Q28. What is the difference between origin and upstream?
Q29. How do you keep a fork in sync with upstream?
Q30. What are Git tags and when do you use them?
Q31. What is git submodule?
Q32. How do you handle a large binary file in Git?
Q33. What does git clean do?
Q34. Scenario: you committed a secret and pushed it. What do you do?
Q35. Scenario: your feature branch is far behind main with conflicts. How do you update it cleanly?
Git Mock Test, 2026 Edition
5 original questions calibrated to the 2026 batch by Aditya Sharma, from candidate-reported patterns.
Question 1
To undo a commit on a shared branch safely, use:
a) git reset --hard b) git revert c) git rebase d) git commit --amend
Solution: revert creates a new undoing commit, preserving history. Answer: (b)
Question 2
You should NOT rebase:
a) local commits b) commits others have already pulled c) your own branch d) WIP commits
Solution: Rebasing shared history rewrites hashes and breaks others. Answer: (b)
Question 3
To recover a lost commit after a hard reset, use:
a) git stash b) git reflog c) git clean d) git fetch
Solution: reflog tracks every HEAD position for recovery. Answer: (b)
Question 4
git reset --soft HEAD~1:
a) deletes changes b) moves HEAD back and keeps changes staged c) pushes d) merges
Solution: Soft reset keeps the changes staged. Answer: (b)
Question 5
To find the commit that introduced a bug, use:
a) git blame b) git bisect c) git log d) git diff
Solution: bisect binary-searches history for the bad commit. Answer: (b)
FAQ, Git Interview Questions
Q: How deep is rebase tested? Candidate-reported rounds expect the merge-vs-rebase trade-off and the golden rule: do not rebase shared history.
Q: Do freshers get Git questions? Yes, branching, staging, merge conflicts, and basic commands. Recovery and workflows skew mid to senior.
Q: Is the reflog commonly asked? Yes, as a recovery question. Knowing it signals real Git experience.
Q: What is the most-missed Git concept? reset vs revert and not rebasing shared branches, per candidate-reported feedback.
You May Also Like
Methodology applied to this articlelast verified 8 Jun 2026
- No fabricated salary numbers or success rates. If we quote a range, it's sourced.
- No noun-substituted templates. This article was not generated by swapping company names in a stock prompt.
- No paid placements, sponsored coaching links, or affiliate-shilled course pushes.
Explore this topic cluster
More resources in Interview Questions
Use the category hub to browse similar questions, exam patterns, salary guides, and preparation resources related to this topic.
Paid contributor programme
Sat this this year? Share your story, earn ₹500.
First-person experience reports help future candidates prep smarter. We pay verified contributors ₹500 via UPI per accepted story - with byline.
Submit your story →Ready to practice?
Take a free timed mock test
Put what you learned into practice. Our mock tests match the 2026 pattern with timer, navigator, reveal, and score breakdown. No signup.
Start Free Mock Test →Related Articles
Airbnb Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing Airbnb's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical, behavioural,...
Airtel Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing Airtel's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical, behavioural,...
AMD Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing AMD's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical, behavioural,...
Atlassian Interview Questions 2026: Top Tech, HR & Behavioural Q&As for Freshers
Clearing Atlassian's fresher loop in 2026 comes down to preparing for the exact mix of questions across technical,...
Barclays Interview Questions 2026
_Last verified by [Aditya Sharma](/author/aditya-sharma/) · cross-checked against PapersAdda Hiring Pulse and...
More from PapersAdda
Accenture Interview Process 2026: Rounds & Prep
Accenture Interview Questions 2026 (with Answers for Freshers)
Adobe Interview Process 2026: Rounds, OA & Aptitude
Amazon Interview Process 2026: Full Loop + Bar Raiser