Git interview questions

Review short answers, detailed answers, practical code and common mistakes.

1. How would you explain Git Introduction in Git during an interview?beginner

Git Introduction is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem git introduction solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/git-introduction
git add src/app
git commit -m "Practice git-introduction"
git log --oneline -3
2. How would you explain Install Git in Git during an interview?beginner

Install Git is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem install git solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

3. How would you explain git init in Git during an interview?beginner

git init is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem git init solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

4. How would you explain git add in Git during an interview?beginner

git add is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem git add solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/git-add
git add src/app
git commit -m "Practice git-add"
git log --oneline -3
5. How would you explain git commit in Git during an interview?beginner

git commit is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem git commit solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

6. How would you explain git status in Git during an interview?beginner

git status is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem git status solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

7. How would you explain Branch in Git during an interview?beginner

Branch is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem branch solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/branch
git add src/app
git commit -m "Practice branch"
git log --oneline -3
8. How would you explain Checkout in Git during an interview?beginner

Checkout is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem checkout solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

9. How would you explain Merge in Git during an interview?beginner

Merge is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem merge solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

10. How would you explain Remote in Git during an interview?beginner

Remote is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem remote solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/remote
git add src/app
git commit -m "Practice remote"
git log --oneline -3
11. How would you explain Push in Git during an interview?intermediate

Push is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem push solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

12. How would you explain Pull in Git during an interview?intermediate

Pull is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem pull solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

13. How would you explain Rebase in Git during an interview?intermediate

Rebase is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem rebase solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/rebase
git add src/app
git commit -m "Practice rebase"
git log --oneline -3
14. How would you explain Stash in Git during an interview?intermediate

Stash is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem stash solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

15. How would you explain Tags in Git during an interview?intermediate

Tags is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem tags solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

16. How would you explain GitHub Workflow in Git during an interview?intermediate

GitHub Workflow is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem github workflow solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/github-workflow
git add src/app
git commit -m "Practice github-workflow"
git log --oneline -3
17. How would you explain Pull Requests in Git during an interview?intermediate

Pull Requests is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem pull requests solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

18. How would you explain Conflict Resolution in Git during an interview?intermediate

Conflict Resolution is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem conflict resolution solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

19. How would you explain Commit Messages in Git during an interview?intermediate

Commit Messages is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem commit messages solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/commit-messages
git add src/app
git commit -m "Practice commit-messages"
git log --oneline -3
20. How would you explain Ignore Files in Git during an interview?intermediate

Ignore Files is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem ignore files solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

21. How would you explain History Inspection in Git during an interview?advanced

History Inspection is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem history inspection solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

22. How would you explain Undo Safely in Git during an interview?advanced

Undo Safely is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem undo safely solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/undo-safely
git add src/app
git commit -m "Practice undo-safely"
git log --oneline -3
23. How would you explain Cherry-pick in Git during an interview?advanced

Cherry-pick is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem cherry-pick solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

24. How would you explain Release Tags in Git during an interview?advanced

Release Tags is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem release tags solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

25. How would you explain Team Workflow in Git during an interview?advanced

Team Workflow is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem team workflow solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/team-workflow
git add src/app
git commit -m "Practice team-workflow"
git log --oneline -3
26. How would you explain Code Review Flow in Git during an interview?advanced

Code Review Flow is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem code review flow solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

27. How would you explain Forks in Git during an interview?advanced

Forks is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem forks solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

28. How would you explain Issues in Git during an interview?advanced

Issues is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem issues solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

git status
git switch -c feature/issues
git add src/app
git commit -m "Practice issues"
git log --oneline -3
29. How would you explain CI Basics in Git during an interview?advanced

CI Basics is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem ci basics solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.

30. How would you explain Git Review in Git during an interview?advanced

Git Review is best explained with its purpose, a small example, and one common mistake.

Start by naming the problem git review solves in Git. Then show a short example, discuss the tradeoff, and mention how you would test it in a real codebase.