---
title: "Git Interview Questions (2026): By Level, With Model Answers"
url: https://weworkworldwide.com/git-interview-questions/
description: "Git interview questions for junior, mid and senior developers — branching, merge vs rebase, resolving conflicts and recovery — with model answers and red flags."
date: 2026-07-04T15:49:17+00:00
source: https://weworkworldwide.com/llms.txt
---

# Git Interview Questions (2026): By Level, With Model Answers

How to use this

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`?

What a strong answer covers

`fetch` downloads remote changes without merging; `pull` fetches and merges (or rebases) into your branch.

Red flag

Thinks they are identical.

### What is the difference between the working directory, staging area and repository?

What a strong answer covers

Edits are in the working directory, staged with `add`, then committed to the repository history.

Red flag

Cannot explain what staging is for.

### What does `git commit` do?

What a strong answer covers

Records a snapshot of staged changes with a message, creating a point in history.

Red flag

Commits everything with meaningless messages.

### What is a branch?

What a strong answer covers

A movable pointer to a line of development, letting work proceed in isolation before merging.

Red flag

Works only on the main branch.

### What is the difference between `git merge` and a fast-forward?

What a strong answer covers

A merge combines histories (sometimes with a merge commit); a fast-forward just moves the pointer when there’s no divergence.

Red flag

Confused by merge commits appearing.

### How do you undo changes before committing?

What a strong answer covers

`git restore`/`checkout` to discard, or unstage with `git reset`; understand what each affects.

Red flag

Deletes files and re-clones to “undo.”

### What is `.gitignore` for?

What a strong answer covers

Excluding files (build output, secrets, dependencies) from version control.

Red flag

Commits `node_modules` and secrets.

### What makes a good commit message?

What a strong answer covers

A concise summary of what and why, so history is useful; small, focused commits help.

Red flag

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?

What a strong answer covers

Merge preserves history with a merge commit; rebase rewrites commits onto a new base for a linear history — don’t rebase shared branches.

Red flag

Rebases a shared branch and rewrites others’ history.

### How do you resolve a merge conflict?

What a strong answer covers

Understand both sides, edit the conflicted regions to the correct result, test, then mark resolved and commit — not just picking one blindly.

Red flag

Accepts one side without understanding the change.

### What is a good branching strategy?

What a strong answer covers

Short-lived feature branches off main with frequent integration (or trunk-based development), keeping branches small.

Red flag

Long-lived branches that drift and conflict badly.

### What does `git cherry-pick` do?

What a strong answer covers

Applies a specific commit onto another branch, useful for hotfixes; overuse signals a workflow problem.

Red flag

Cherry-picks widely and creates duplicate/divergent history.

### What is the difference between `git reset` and `git revert`?

What a strong answer covers

`reset` moves the branch pointer (rewriting history); `revert` creates a new commit undoing changes safely on shared branches.

Red flag

Uses `reset --hard` on a shared branch.

### What does `git stash` do?

What a strong answer covers

Temporarily shelves uncommitted changes so you can switch context, then reapply them.

Red flag

Commits half-done work to switch branches.

### How do pull requests fit a Git workflow?

What a strong answer covers

Changes on a branch reviewed via a PR before merging, enabling review, CI and discussion.

Red flag

Pushes directly to main with no review.

### What is the difference between a local and remote branch?

What a strong answer covers

Local branches live in your clone; remote-tracking branches mirror the remote’s state and are updated on fetch.

Red flag

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?

What a strong answer covers

`git reflog` tracks where HEAD has been, so you can find and restore “lost” commits.

Red flag

Believes a hard reset permanently deleted the work.

### When is rewriting history acceptable?

What a strong answer covers

On local or unshared branches to clean up before sharing; never on shared/public branches others have based work on.

Red flag

Force-pushes rewritten history to a shared branch.

### How do you find which commit introduced a bug?

What a strong answer covers

`git bisect` to binary-search history against a test, isolating the offending commit quickly.

Red flag

Reads every commit manually.

### How do you keep a clean, useful history at scale?

What a strong answer covers

Small focused commits, meaningful messages, interactive rebase before sharing, and a consistent team workflow.

Red flag

A tangle of “wip” commits and giant merges.

### How do you handle large files or monorepos in Git?

What a strong answer covers

Git LFS for large binaries, and tooling/partial-clone strategies for big monorepos to keep operations fast.

Red flag

Commits large binaries directly and bloats the repo.

### What does a good code-review-friendly PR look like?

What a strong answer covers

Small, single-purpose, with a clear description and passing CI, so reviewers can reason about it.

Red flag

Opens a giant, unfocused PR touching everything.

### How do you protect important branches?

What a strong answer covers

Branch protection rules requiring reviews, passing CI, and blocking force-push to main.

Red flag

Anyone can force-push to main.

### How do you handle a secret accidentally committed?

What a strong answer covers

Rotate the secret immediately (assume it’s compromised), then purge it from history — removing the commit alone isn’t enough.

Red flag

Just deletes the file in a new commit and considers it safe.

**Skip the screening entirely.**We vet Git engineers so you don’t have to — embed one in your team, or have us build it.

[Hire Git developers](https://weworkworldwide.com/outstaffing/)[Compare us](https://weworkworldwide.com/compare/)

Build and score a full interview with our free [interview scorecard tool](https://weworkworldwide.com/developer-interview-scorecard/), browse the [full question hub](https://weworkworldwide.com/interview-questions/), or see [how we interview engineers](https://weworkworldwide.com/how-we-interview-engineers/).
