Top Interview Questions & Practice
Master 50+ essential Git interview questions ranging from core fundamentals to senior-level real-world scenarios.
Junior Fundamentals
Test your understanding of Git's core concepts, repository structure, commits, staging, branches, and everyday commands.
Understand Git's distributed model.
Know the difference between working tree, index, and repository.
Be able to explain common everyday commands.
- What is Git?
Core Git Concepts
These questions cover the fundamental objects and areas that make Git different from simpler version-control systems.
- What does
git initdo?
Staging and Commits
Practice questions about the staging area, diffs, commits, amend, reset, and restoring files.
- What does
git adddo?
Branching Questions
Test your knowledge of branch references, HEAD, switching, tracking, and branch lifecycle.
- Why are Git branches lightweight?
Remote Collaboration Questions
Test remote repositories, fetch, pull, push, upstream branches, and pull requests.
- What does
git fetchdo?
Intermediate Git Questions
Challenge yourself with merge, rebase, conflicts, stash, cherry-pick, tags, and history inspection.
- What is the main difference between merge and rebase?
Advanced History Questions
These questions focus on reflog, reset modes, detached HEAD, bisect, and history rewriting.
- What is the main purpose of
git reflog?
Git Internals Questions
Explore Git's object model, refs, the index, object IDs, and storage.
- Which object stores the contents of a file?
Real-World Scenarios
Practice practical situations that commonly appear in Git interviews.
- You accidentally ran
git reset --hard HEAD~1. What should you check first to recover the previous commit?
Senior Git Workflow Questions
These questions cover team practices, protected branches, CI, history rewriting, and repository design.
- Why should shared public history generally not be rebased casually?
Interview Question 11
Core Git knowledge.
- What does HEAD usually point to?
Interview Question 12
Core Git knowledge.
- Which command shows unstaged changes?
Interview Question 13
Core Git knowledge.
- Which command shows staged changes?
Interview Question 14
Core Git knowledge.
- What does
git commit --amenddo?
Interview Question 15
Reset knowledge.
- Which reset mode leaves changes staged?
Interview Question 16
Reset knowledge.
- What does default
git resetmode do to the index?
Interview Question 17
Reset safety.
- Why is
git reset --harddangerous?
Interview Question 18
Merge knowledge.
- When can a merge be fast-forward?
Interview Question 19
Merge knowledge.
- How many parents can a normal merge commit have?
Interview Question 20
Rebase knowledge.
- What does rebase primarily do?
Interview Question 21
Rebase knowledge.
- Why do rebased commits have different hashes?
Interview Question 22
Conflict resolution.
- What do
<<<<<<<and>>>>>>>indicate?
Interview Question 23
Conflict resolution.
- How do you tell Git a conflicted file is resolved?
Interview Question 24
Rebase conflict recovery.
- Which command cancels an in-progress rebase?
Interview Question 25
Interactive rebase.
- What is interactive rebase commonly used for?
Interview Question 26
Cherry-pick.
- When is cherry-pick useful?
Interview Question 27
Cherry-pick.
- Does cherry-pick preserve the original commit hash?
Interview Question 28
Stash.
- What does
git stashdo?
Interview Question 29
Stash.
- Which command includes untracked files in a stash?
Interview Question 30
Remote repositories.
- What is
origin?