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.
1. What is Git?
Core Git Concepts
These questions cover the fundamental objects and areas that make Git different from simpler version-control systems.
2. What does `git init` do?
Staging and Commits
Practice questions about the staging area, diffs, commits, amend, reset, and restoring files.
3. What does `git add` do?
Branching Questions
Test your knowledge of branch references, HEAD, switching, tracking, and branch lifecycle.
4. Why are Git branches lightweight?
Remote Collaboration Questions
Test remote repositories, fetch, pull, push, upstream branches, and pull requests.
5. What does `git fetch` do?
Intermediate Git Questions
Challenge yourself with merge, rebase, conflicts, stash, cherry-pick, tags, and history inspection.
6. 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.
7. What is the main purpose of `git reflog`?
Git Internals Questions
Explore Git's object model, refs, the index, object IDs, and storage.
8. Which object stores the contents of a file?
Real-World Scenarios
Practice practical situations that commonly appear in Git interviews.
9. 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.
10. Why should shared public history generally not be rebased casually?