Master Git interview questions with MCQs covering the version control concepts software engineers are expected to know at every level. Topics include the three-tree architecture (working directory, staging area, commit graph), branching strategies, merging vs rebasing, cherry-pick, interactive rebase, stash, reset (soft, mixed, hard), revert, reflog, remote repository operations, fetch vs pull, tagging, bisect, and Git workflows including Git Flow, GitHub Flow, and trunk-based development. Git knowledge is tested in nearly every software engineering interview from junior screenings to senior system design rounds, because teams need developers who manage code history cleanly and resolve conflicts safely without disrupting shared branches. Difficulty levels cover Trainee (basic commands, staging, committing, basic branching), Junior Dev (branching strategies, merging, remote operations, conflict resolution), Mid Level (rebase workflows, cherry-pick, advanced reset, bisect), and Senior Dev (Git internals, large-repo strategies, CI/CD integration patterns). Every explanation builds genuine Git fluency rather than rote memorization of commands.
What this Git & GitHub quiz covers
Trainee
- git status, log and show
- Branches, checkout and switch
- git push and tags
- What a commit hash identifies
Junior Developer
- fetch vs pull, and fetch --prune
- .gitignore and force pushing
- Fast-forward merges and remote-tracking branches
- Submodules and annotated tags
Mid-Level
- Merge vs rebase
- Detached HEAD, reflog and ORIG_HEAD
- Hooks, including pre-receive
- Sparse checkout and git bundle
Senior
- Why not to rebase shared commits
- Rewriting history with filter-repo or BFG
- Packfiles, reachability and three-way merges
- Credential helpers and git maintenance
Sample Git & GitHub Interview Questions
Ten representative questions from our full bank of Git & GitHub MCQs across all difficulty levels. Each one shows the correct answer and a short explanation. The interactive quiz above shuffles options and tracks your time per question.
- TraineeQ1
What does git status show?
- Working tree and staging state Correct
- CPU usage
- Package versions
- Open ports
Why: git status reports changed, staged, untracked, and branch information. - TraineeQ2
What does git add do?
- Stages changes for the next commit Correct
- Commits changes to history
- Pushes changes to remote
- Deletes branches
Why: git add places selected changes into the staging area. - TraineeQ3
What does git commit create?
- A snapshot in repository history Correct
- A remote repository
- A package archive
- A running server
Why: A commit records staged changes with a message, author, and timestamp. - TraineeQ4
What is a branch?
- A movable pointer to a commit Correct
- A folder on disk only
- A release tag only
- A database table
Why: Branches are named references that move forward as new commits are added. - Junior DevQ5
git fetch differs from pull because fetch?
- Downloads without merging into current branch Correct
- Deletes files
- Commits automatically
- Requires GitHub
Why: fetch updates remote-tracking refs but does not integrate them into your branch. - Junior DevQ6
What is a pull request?
- A proposed branch merge for review Correct
- A local stash
- A package install
- A database query
Why: Pull requests enable review, discussion, and checks before merging. - Junior DevQ7
What does git stash do?
- Temporarily saves uncommitted work for later restoration Correct
- Permanently deletes uncommitted commits
- Creates an annotated tag
- Pushes code to a remote branch
Why: stash stores dirty working directory changes so you can switch context. - Mid LevelQ8
merge vs rebase?
- Merge preserves branch history; rebase replays commits linearly Correct
- They are identical in all scenarios
- Rebase only pushes changes to remote
- Merge permanently deletes source commits
Why: Rebase rewrites commits onto a new base; merge creates a merge commit preserving history. - Mid LevelQ9
What does cherry-pick do?
- Applies one commit's changes onto the current branch Correct
- Permanently deletes a specific commit
- Renames a branch to a new name
- Creates a new remote connection
Why: cherry-pick copies the change introduced by a specific commit. - Senior DevQ10
Why avoid rebasing public shared commits?
- It rewrites commit SHAs that collaborators may have based work on Correct
- It permanently removes configured remotes
- It breaks all annotated tags unconditionally
- It uninstalls Git from the system
Why: Rewriting published history disrupts collaborators' branches and workflows.
This is a static preview of 10 questions. Take the full interactive Git & GitHub quiz with timed rounds, all 25 questions per level, and instant score tracking.
Frequently Asked Questions: Git & GitHub Interviews
Common questions developers ask when preparing for Git & GitHub technical interviews.
What Git concepts are most commonly tested in software engineering interviews?
Branching and merging come up most frequently, interviewers want to see you know the difference between merge and rebase, when to use each, and how to resolve conflicts. The staging area and commit model, reset vs revert (and when to use which safely), cherry-pick, stash, and remote operations (fetch vs pull) are also commonly tested. Senior roles may ask about Git internals (objects: blob, tree, commit, tag) and large-repo workflows.
What is the difference between git merge and git rebase?
git merge integrates changes by creating a merge commit that has two parents, preserving the full history of both branches. git rebase replays commits from your branch on top of the target branch, producing a linear history without merge commits. Rebase makes history cleaner and easier to read but rewrites commit SHAs, it should never be used on shared/public branches since it forces collaborators to reconcile diverged history. Use merge for integrating feature branches; use rebase for keeping your feature branch up-to-date with main.
What is the difference between git reset and git revert?
git reset moves the HEAD pointer (and optionally the index and working tree) to a previous commit, effectively rewriting local history. It is destructive and should not be used on commits already pushed to a shared branch. git revert creates a new commit that undoes the changes from a specified commit, preserving history, it is the safe way to undo changes on public branches without rewriting them.
What is a Git stash and when should you use it?
git stash temporarily saves your uncommitted changes (both staged and unstaged) and reverts the working tree to the last commit, without creating a commit. Use it when you need to switch branches urgently but are not ready to commit your in-progress work. git stash pop restores the most recent stash; git stash list shows all stashed states. For named stashes use git stash save 'description'. Stashes are local and do not sync to remote repositories.
What Git workflow should teams use for collaborative development?
The right workflow depends on team size and deployment cadence. GitHub Flow (short-lived feature branches merged to main with immediate deployment) suits small teams with continuous deployment. Git Flow (main, develop, feature, release, hotfix branches) suits teams with scheduled releases. Trunk-based development (very short-lived branches or direct commits to main with feature flags) is used by high-velocity engineering teams at companies like Google and Facebook. Most interviewers want to see that you understand the trade-offs, not just one workflow.