Home › Blog › Git interview questions

Git interview questions

Git questions are practical: here is a mess, how do you get out of it. Interviewers are checking whether you understand commits as snapshots and branches as pointers, because every recovery follows from that.

The model

Merge versus rebase

Almost nothing in git is truly lost. `git reflog` is the answer to a surprising share of "how do you recover" questions, and candidates who reach for it first look experienced.

Undoing things, the scenario round

Conflicts and workflow

What a conflict actually is - the same lines changed on both sides - and how you resolve one deliberately rather than by accepting a side wholesale. Then workflow: trunk-based against long-lived branches, why short-lived branches reduce conflict pain, what a good commit message contains, and what you look for in a pull request. The review-culture half overlaps with QA engineer interview questions.

How deep it goes by level

Whatever the level, say your answers out loud rather than reading them. Most of what candidates lose in a Git interview is lost between knowing something and explaining it under observation - the method is in how to use AI for interview prep.

Where CoPilot Interview fits

Disclosure: we build an interview assistant, so treat this as a disclosed pitch. CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds, with a permanent free tier that needs no credit card.

Frequently asked questions

What are the most common Git interview questions?

Merge versus rebase and when not to rebase, the difference between reset modes, how to undo a pushed commit, recovering work with reflog, and what to do when a secret has been committed.

How do you undo a commit that has already been pushed?

Use `git revert`, which creates a new commit undoing the change and leaves history intact. `reset` plus a force-push rewrites history that others already have, which breaks their clones and is why it is the wrong tool on a shared branch.

What is the difference between git reset --soft, --mixed and --hard?

`--soft` moves the branch pointer and keeps changes staged, `--mixed` keeps them in the working directory unstaged, and `--hard` discards them entirely. Only `--hard` loses work, and even then the commits are usually recoverable through reflog.

What should you do if you commit a secret?

Rotate the secret first, because it must be treated as compromised the moment it was pushed. Then remove it from history and force-push, while recognising that existing clones and any caching layer may still hold the old objects.

Walk into the round with a second pair of eyes

CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds. The free tier is permanent: 15 minutes a day, no credit card.

Try it free