Git interview questions

Merge vs rebase, resolving conflicts, undoing mistakes safely, leaked secrets and team workflows.

Readiness: 0 of 9 nailed

How to use this page: 1. Read a question2. Type your answer3. Check with AI4. Open the model answer5. Timed drill when you’re 70% ready

Branching

JuniorConcept

Merge vs rebase?

FoundationReal-world scenario

How do you resolve a merge conflict?

JuniorConcept

What does squashing commits mean, and when do you do it?

Mid-levelConcept

Compare Git Flow and trunk-based development.

Undoing

JuniorConcept

git revert vs git reset? How do you undo a bad commit that’s already pushed?

Security

Mid-levelReal-world scenario

You accidentally pushed an API key to GitHub. What now?

Everyday commands

JuniorConcept

What do git stash and git cherry-pick do?

JuniorIt’s broken: why?

You added .env to .gitignore, but Git still tracks it. Why?

Debugging

Mid-levelConcept

How would you find which commit introduced a bug among 200 commits?

Also prepare