Back to Tech Interviews

Git Version Control Interview

Curated 20+ questions covering local/remote git operations, staging, branches, rebase, cherry-pick, reset, and revert.

Total: 20 QuestionsLearned: 0 / 20 (0%)
Difficulty Filters

Tools & Options
Showing 20 of 20 questions
Beginner
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.

Beginner
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 Repository
Intermediate
What 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.

Intermediate
Explain the difference between `git merge` and `git rebase`.
Beginner
What is a fast-forward merge?
Intermediate
What is `git stash`, and when is it used?
Intermediate
What is the difference between `git reset` and `git revert`?
Advanced
Explain the differences between `git reset --soft`, `--mixed`, and `--hard`.
Intermediate
What is `git cherry-pick`?
Advanced
What is `git reflog`?
Beginner
What is a merge conflict, and how do you resolve it?
Beginner
What is a Git commit hash (SHA-1)?
Advanced
Explain Git hooks.
Beginner
What is the purpose of the `.gitignore` file?
Beginner
How do you view the commit history in Git?
Intermediate
What is `git checkout` vs `git switch`?
Intermediate
How do you rename a branch in Git?
Advanced
What is a detached HEAD state, and how do you resolve it?
Intermediate
Explain the difference between origin and upstream in Git.
Scenario
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.

Continuous learning: Practice daily, mark completed questions as learned, and revisit difficult concepts.Explore All Interview Tracks →

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Related Tools