Everyone uses Git; few understand it. These questions check whether a candidate can reason about history, branching and recovery — not just memorise commands.
Hiring a Git developer is easy. Telling a real one from a convincing résumé is the hard part — and it’s most of what we do. These are grouped by level, because the same question that stretches a junior is a warm-up for a senior.
Junior Git interview questions
0–2 years
Basics.
What is the difference between git fetch and git pull?
fetch downloads remote changes without merging; pull fetches and merges (or rebases) into your branch.
Thinks they are identical.
What is the difference between the working directory, staging area and repository?
Edits are in the working directory, staged with add, then committed to the repository history.
Cannot explain what staging is for.
What does git commit do?
Records a snapshot of staged changes with a message, creating a point in history.
Commits everything with meaningless messages.
What is a branch?
A movable pointer to a line of development, letting work proceed in isolation before merging.
Works only on the main branch.
What is the difference between git merge and a fast-forward?
A merge combines histories (sometimes with a merge commit); a fast-forward just moves the pointer when there’s no divergence.
Confused by merge commits appearing.
How do you undo changes before committing?
git restore/checkout to discard, or unstage with git reset; understand what each affects.
Deletes files and re-clones to “undo.”
What is .gitignore for?
Excluding files (build output, secrets, dependencies) from version control.
Commits node_modules and secrets.
What makes a good commit message?
A concise summary of what and why, so history is useful; small, focused commits help.
Writes “fix” or “stuff” on huge commits.
Mid-level Git interview questions
2–5 years
Branching and history.
What is the difference between merge and rebase?
Merge preserves history with a merge commit; rebase rewrites commits onto a new base for a linear history — don’t rebase shared branches.
Rebases a shared branch and rewrites others’ history.
How do you resolve a merge conflict?
Understand both sides, edit the conflicted regions to the correct result, test, then mark resolved and commit — not just picking one blindly.
Accepts one side without understanding the change.
What is a good branching strategy?
Short-lived feature branches off main with frequent integration (or trunk-based development), keeping branches small.
Long-lived branches that drift and conflict badly.
What does git cherry-pick do?
Applies a specific commit onto another branch, useful for hotfixes; overuse signals a workflow problem.
Cherry-picks widely and creates duplicate/divergent history.
What is the difference between git reset and git revert?
reset moves the branch pointer (rewriting history); revert creates a new commit undoing changes safely on shared branches.
Uses reset --hard on a shared branch.
What does git stash do?
Temporarily shelves uncommitted changes so you can switch context, then reapply them.
Commits half-done work to switch branches.
How do pull requests fit a Git workflow?
Changes on a branch reviewed via a PR before merging, enabling review, CI and discussion.
Pushes directly to main with no review.
What is the difference between a local and remote branch?
Local branches live in your clone; remote-tracking branches mirror the remote’s state and are updated on fetch.
Confused about why local and remote differ.
Senior Git interview questions
5+ years
Recovery and workflow.
How do you recover a lost commit or branch?
git reflog tracks where HEAD has been, so you can find and restore “lost” commits.
Believes a hard reset permanently deleted the work.
When is rewriting history acceptable?
On local or unshared branches to clean up before sharing; never on shared/public branches others have based work on.
Force-pushes rewritten history to a shared branch.
How do you find which commit introduced a bug?
git bisect to binary-search history against a test, isolating the offending commit quickly.
Reads every commit manually.
How do you keep a clean, useful history at scale?
Small focused commits, meaningful messages, interactive rebase before sharing, and a consistent team workflow.
A tangle of “wip” commits and giant merges.
How do you handle large files or monorepos in Git?
Git LFS for large binaries, and tooling/partial-clone strategies for big monorepos to keep operations fast.
Commits large binaries directly and bloats the repo.
What does a good code-review-friendly PR look like?
Small, single-purpose, with a clear description and passing CI, so reviewers can reason about it.
Opens a giant, unfocused PR touching everything.
How do you protect important branches?
Branch protection rules requiring reviews, passing CI, and blocking force-push to main.
Anyone can force-push to main.
How do you handle a secret accidentally committed?
Rotate the secret immediately (assume it’s compromised), then purge it from history — removing the commit alone isn’t enough.
Just deletes the file in a new commit and considers it safe.
Build and score a full interview with our free interview scorecard tool, browse the full question hub, or see how we interview engineers.