Git Interview Questions
The object model that explains everything else — branching and merging, rebase and history rewriting, undoing mistakes and recovering lost work, collaboration workflows, and the tools most people never use.
Showing 1–20 of 100
#1What are the four Git object types and how do they fit together?
#2What is a branch in Git, really?
#3What are the three trees — working directory, index, and HEAD?
#4Why does Git store snapshots rather than diffs?
#5What is the difference between git fetch, pull, and clone?
#6What is HEAD and what does detached HEAD mean?
#7What is the difference between a lightweight and an annotated tag?
#8What does the index actually store?
#9How does Git determine whether a file was renamed?
#10What is the difference between .gitignore and .git/info/exclude?
#11What is the reflog and why is it the most useful recovery tool?
#12What happens during git gc?
#13What is the difference between origin/main and main?
#14Why do two identical-looking commits have different hashes?
#15What is a fast-forward merge and when does it not happen?
#16How does a three-way merge work?
#17How do you resolve a merge conflict properly?
#18What is the difference between merge and rebase?
#19What is a squash merge and what do you lose?
#20What is git cherry-pick and when is it appropriate?
Showing 1–20 of 100
Ask Aria about Git
Sign in to chat with Aria
All 100 Git questions at a glance
- What are the four Git object types and how do they fit together?(Medium)
- What is a branch in Git, really?(Easy)
- What are the three trees — working directory, index, and HEAD?(Medium)
- Why does Git store snapshots rather than diffs?(Medium)
- What is the difference between git fetch, pull, and clone?(Easy)
- What is HEAD and what does detached HEAD mean?(Medium)
- What is the difference between a lightweight and an annotated tag?(Easy)
- What does the index actually store?(Hard)
- How does Git determine whether a file was renamed?(Medium)
- What is the difference between .gitignore and .git/info/exclude?(Easy)
- What is the reflog and why is it the most useful recovery tool?(Medium)
- What happens during git gc?(Hard)
- What is the difference between origin/main and main?(Easy)
- Why do two identical-looking commits have different hashes?(Medium)
- What is a fast-forward merge and when does it not happen?(Easy)
- How does a three-way merge work?(Medium)
- How do you resolve a merge conflict properly?(Medium)
- What is the difference between merge and rebase?(Medium)
- What is a squash merge and what do you lose?(Medium)
- What is git cherry-pick and when is it appropriate?(Medium)
- What is git rerere and what problem does it solve?(Hard)
- How do you keep a long-lived feature branch current?(Medium)
- What causes a merge conflict that Git could have avoided?(Medium)
- What are the merge strategies and when would you change from the default?(Hard)
- What is an octopus merge?(Hard)
- How do you find which commit introduced a bug?(Medium)
- What does git blame tell you and what are its limits?(Medium)
- What is a merge commit and should you avoid them?(Medium)
- What does git rebase actually do, step by step?(Medium)
- What is interactive rebase used for?(Medium)
- Why is rebasing published history dangerous?(Medium)
- What is the difference between --force and --force-with-lease?(Hard)
- What is git commit --amend and when should you not use it?(Easy)
- How do you split one commit into several?(Hard)
- How do you remove a secret that was committed?(Hard)
- What is git filter-repo and why replace filter-branch?(Hard)
- What does git rebase --onto do?(Hard)
- What makes a good commit message?(Easy)
- How should you structure a series of commits in a pull request?(Medium)
- What is git commit --fixup and --autosquash?(Hard)
- When is it acceptable to rewrite history?(Medium)
- How do you recover from a rebase that went wrong?(Medium)
- What is a remote and how do remote-tracking branches work?(Easy)
- What is the difference between git push and git push -u?(Easy)
- How do you contribute to a project you do not have write access to?(Easy)
- What is a shallow clone and when is it useful?(Medium)
- What are Git submodules and what are their problems?(Hard)
- What is Git LFS and when do you need it?(Medium)
- How do Git hooks work and what are they used for?(Medium)
- What is a bare repository?(Medium)
- How do you handle a large binary accidentally committed?(Hard)
- What is the difference between a fork and a branch?(Easy)
- How do you sign commits and why would you?(Medium)
- What is git worktree and what problem does it solve?(Medium)
- What is the difference between git reset --soft, --mixed and --hard?(Medium)
- When do you use git revert instead of git reset?(Medium)
- How do you undo changes to a file in the working directory?(Easy)
- How does git stash work and what are its pitfalls?(Medium)
- How do you recover a deleted branch?(Medium)
- How do you undo a git push?(Medium)
- How do you recover a commit after a hard reset?(Medium)
- How do you remove a file from the last commit without losing it?(Medium)
- What does git clean do and why is it dangerous?(Medium)
- How do you undo a merge that has already been pushed?(Hard)
- How do you fix a commit made on the wrong branch?(Medium)
- What is git reset --hard ORIG_HEAD and when is it useful?(Medium)
- You committed with the wrong author. How do you fix it?(Medium)
- What is the safest way to experiment with a risky Git operation?(Medium)
- What is Git Flow and what are its criticisms?(Medium)
- What is trunk-based development?(Medium)
- What branch protection rules would you configure?(Medium)
- Should you squash, rebase, or merge pull requests?(Medium)
- How do you handle hotfixes to production?(Medium)
- How do you manage releases with tags?(Medium)
- What is a monorepo and what are the Git implications?(Hard)
- How do you review a large pull request effectively?(Medium)
- What Git configuration would you set on a new machine?(Medium)
- How do you handle a repository with an inconsistent commit history?(Medium)
- What is the difference between CI on a branch and CI on the merge result?(Hard)
- How should a team decide on a branching strategy?(Medium)
- What can you do with git log that most people do not?(Medium)
- What is the pickaxe search and when is it the right tool?(Hard)
- What does git diff show by default and how do you get the diff you want?(Medium)
- What is git add -p and why is it worth using?(Medium)
- What are Git attributes used for?(Hard)
- What is sparse-checkout and when do you need it?(Hard)
- What is git notes and why is it rarely used?(Hard)
- How does git bisect run work?(Medium)
- What is a refspec?(Hard)
- How do you find a commit when you only remember roughly what it did?(Medium)
- What is the difference between two-dot and three-dot notation?(Hard)
- What are some Git aliases worth setting up?(Easy)
- Git says your branch has diverged. What does that mean and what do you do?(Easy)
- Why might git status show a file as modified when you have not changed it?(Medium)
- Why is a file still tracked after adding it to .gitignore?(Easy)
- What causes "refusing to merge unrelated histories"?(Medium)
- How do you deal with a repository that has become very slow?(Hard)
- Someone force-pushed and your work is gone. What do you do?(Medium)
- How do you debug a merge that produced broken code with no conflicts?(Hard)
- What is the mental model that makes Git make sense?(Medium)