>DevOps Interview KB

Git Interview Questions — All Categories

13 questions tagged with Git as a technology, across every category it appears in

Related categories:GitSecurity

What's the actual difference between git fetch and git pull, and why do some teams recommend always fetching first?

BeginnerGit5 min

Two engineers are working on the same long-lived feature branch. One wants to rebase onto main daily, the other insists on merging main in. Who's right, and how do you decide?

BeginnerGit8 min

What's the actual difference between git merge and git rebase in terms of what happens to the commit graph, not just the end result you see?

BeginnerGit6 min

A teammate's work was lost after a force-push overwrote their commits on a shared branch. How would you recover it?

IntermediateGit7 min

When would you choose squash-merge over a regular merge commit for landing a pull request into main?

BeginnerGit6 min

A bug was introduced somewhere in the last 200 commits, but nobody knows exactly which one, and the bug doesn't reproduce reliably enough to eyeball the diffs. How would you find the exact commit using git bisect?

IntermediateGit6 min

A critical bug fix landed on main, and you need to get it onto a release branch that's several weeks behind. Should you cherry-pick the fix, or rebase the release branch onto main?

IntermediateGit6 min

A feature branch has 15 messy commits ('wip', 'fix typo', 'actually fix it') before it's ready for review. How would you use interactive rebase to clean this up into a coherent history?

IntermediateGit6 min

A repository has grown to several gigabytes because it stores large binary assets (design files, ML model weights) directly, making every clone painfully slow. How would you fix this?

IntermediateGit7 min

A teammate resolved a merge conflict by keeping 'their' version of every conflicting hunk without actually reading the other side's changes. Why is that dangerous, and how should conflicts actually be resolved?

IntermediateGit6 min

A secret was committed several commits ago and has since been rotated, but it's still sitting in the repository's Git history. How do you actually remove it, not just delete it in a new commit?

AdvancedGit7 min

How would your incident response to a hardcoded secret committed to a repository differ if the repository were private rather than public?

IntermediateGit6 min

What's the trade-off between rewriting Git history to remove a committed secret versus simply rotating it and leaving the now-worthless value in history?

IntermediateGit6 min