Git Interview Questions
Version control, merge vs rebase, staging, reset/revert, branching, conflicts, stash, reflog, cherry-pick, tags and internals.
61 questions
Popular Searches
1. What is Git and how does distributed version control differ from centralized version control?
easyVersion Control Fundamentals 6 mins2. What is the difference between git merge and git rebase?
mediumBranching & Integration 7 mins3. What is the difference between git fetch and git pull?
easyRemotes & Syncing 6 mins4. What is the Git staging area (index) and why does it exist?
easyGit Internals 6 mins5. What is the difference between git reset, git revert, and git checkout?
mediumHistory Management 8 mins6. How does a Git branch work internally and why is branching cheap in Git?
mediumGit Internals 7 mins7. What is a detached HEAD state in Git and how do you recover from it?
mediumReferences & HEAD 6 mins8. What is the difference between a fast-forward merge and a three-way merge?
mediumMerging 6 mins9. How do you resolve a merge conflict in Git?
mediumMerging 6 mins10. What is git stash and when should you use it?
easyWorking Directory 6 mins11. What is the difference between git reset --soft, --mixed, and --hard?
mediumUndoing Changes 7 mins12. What is a Git remote and how do origin and upstream differ?
mediumRemotes 6 mins13. What is interactive rebase and what can you do with it?
mediumHistory Rewriting 7 mins14. What is the difference between git cherry-pick and git rebase?
mediumHistory Management 7 mins15. How does Git store data internally with blobs, trees, and commits?
hardGit Internals 8 mins16. What is the difference between a lightweight tag and an annotated tag?
easyTagging 6 mins17. What is git reflog and how can it save you from lost commits?
mediumRecovery 7 mins18. What is the difference between tracked, untracked, and ignored files in Git?
easyWorking Tree 6 mins19. How does git bisect help you find a bug-introducing commit?
mediumDebugging 6 mins20. What is a good Git branching strategy and how do Git Flow and trunk-based development differ?
mediumBranching Strategy 7 mins21. What is the difference between git rm and just deleting a file?
easyWorking Tree 5 mins22. How do you undo the last commit in Git without losing your changes?
easyHistory & Undo 6 mins23. What is a Git submodule and when should you use one?
mediumRepositories & Structure 7 mins24. What is the difference between HEAD, a branch, and a commit SHA in Git?
mediumCore Concepts 7 mins25. How does .gitignore work and what are its precedence rules?
mediumRepository Configuration 7 mins26. What is a squash merge and when is it appropriate?
mediumMerging & History 7 mins27. How does git blame work and when is it useful?
easyInspecting History 6 mins28. What is the difference between origin/main and main in Git?
easyBranches & Remotes 6 mins29. What are Git hooks and what are common use cases?
mediumAutomation 7 mins30. How do you safely force-push and what does --force-with-lease do?
hardRemotes & History 8 mins31. What is Git?
easyFundamentals 5 mins32. What is a Commit in Git?
easyFundamentals 5 mins33. What is a Branch in Git?
easyFundamentals 5 mins34. What is Git Stash?
easyWorkflow 5 mins35. What is Git Cherry-Pick?
easyWorkflow 5 mins36. What is a Merge Conflict?
mediumCollaboration 6 mins37. What is Git Reset vs Revert?
mediumUndoing Changes 6 mins38. What is HEAD in Git?
mediumInternals 6 mins39. What is a Remote in Git?
mediumCollaboration 6 mins40. What is the difference between git fetch and git pull?
mediumRemotes 6 mins41. What is a fast-forward merge in Git?
mediumMerging 5 mins42. What is a .gitignore file and how does it work?
mediumConfiguration 5 mins43. What does the git log command do?
mediumHistory 5 mins44. What is a detached HEAD state in Git?
hardInternals 6 mins45. What is git bisect and how does it find bugs?
hardDebugging 6 mins46. What is a Git tag and how does it differ from a branch?
hardReleases 6 mins47. What is git reflog used for?
hardRecovery 6 mins48. What is squashing commits in Git?
hardHistory Rewriting 6 mins49. You ran git reset --hard and lost committed work. How do you get it back?
mediumRecovery 9 mins50. What does a rebase actually rewrite, and why is --force-with-lease safer than --force?
hardHistory Rewriting 10 mins51. How do you automate git bisect to hunt a regression, and what makes a bisect give the wrong answer?
hardDebugging 10 mins52. What is a git worktree, and when is it better than stashing or a second clone?
mediumWorkflow 9 mins53. Submodules or subtrees for sharing code between repositories, and how does each fail?
hardRepository Structure 11 mins54. What is git rerere, and when does it genuinely save time?
hardConflicts 9 mins55. A monorepo clone is painfully slow. How do sparse checkout and partial clone help?
hardScaling 10 mins56. Where do git hooks actually run, and why are client-side hooks not an enforcement mechanism?
mediumAutomation 9 mins57. What does signing a git commit actually prove, and what does it not?
hardSecurity 11 mins58. What merge strategies does git offer, and how do you work through a rebase that keeps conflicting?
hardConflicts 11 mins59. A bug is in production. Do you cherry-pick the fix or revert the offending commit on the release branch?
hardRelease Management 11 mins60. How do you read a three-way conflict, and what does the merge base tell you that the two sides do not?
mediumConflicts 10 mins61. An API key was committed and pushed. What do you do, in what order?
hardSecurity 11 mins