Git Version Control Interview
Curated 20+ questions covering local/remote git operations, staging, branches, rebase, cherry-pick, reset, and revert.
Difficulty Filters
Tools & Options
What is Git, and what is a Distributed Version Control System (DVCS)?
Git is a fast, open-source distributed version control system. In a Distributed Version Control System (DVCS), clients do not just check out the latest snapshot of the files from a central server; they fully mirror the repository, including its entire history, locally. If the server dies, any client repository can be copied back up to the server to restore it.
What are the three main states/areas in Git?
Git has three main states that your files can reside in:
1. Working Directory: The local area where you create and modify project files.
2. Staging Area (Index): A virtual file that lists changes scheduled to be included in the next commit.
3. Git Repository (.git directory): The metadata database storing the permanent snapshots of your project commits.
# Flow of states:
Working Directory --(git add)--> Staging Area --(git commit)--> Git RepositoryWhat is the difference between `git pull` and `git fetch`?
`git fetch` contacts the remote repository and downloads all new metadata and commits from the remote branches to your local tracker, but does not merge them into your working files. `git pull` is a combination command that performs a `git fetch` followed by a `git merge`, immediately pulling and merging remote changes into your current active local branch.
Explain the difference between `git merge` and `git rebase`.
What is a fast-forward merge?
What is `git stash`, and when is it used?
What is the difference between `git reset` and `git revert`?
Explain the differences between `git reset --soft`, `--mixed`, and `--hard`.
What is `git cherry-pick`?
What is `git reflog`?
What is a merge conflict, and how do you resolve it?
What is a Git commit hash (SHA-1)?
Explain Git hooks.
What is the purpose of the `.gitignore` file?
How do you view the commit history in Git?
What is `git checkout` vs `git switch`?
How do you rename a branch in Git?
What is a detached HEAD state, and how do you resolve it?
Explain the difference between origin and upstream in Git.
How can you undo a commit that was already pushed to a public remote branch?
Technical Interview Mastery Blueprint
Proven methodologies and frameworks to succeed in technical and architecture rounds.
1. The Engineering STAR Technique
When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.
2. Defending Architectural Trade-Offs
Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.
3. Clean Code & Edge-Case Proactivity
In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.
4. Antipatterns to Avoid
Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.
Explore Related Tools
Hand-picked utilities and calculators related to this tool.
