Back to Topics

Git & GitHub Interview Questions

MCQ Quiz · All Difficulty Levels

1 · Choose Difficulty

2 · Number of Questions

3 · Timer per Question

Launch Quiz

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.

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.