SESK: Stuff Everyone Should Know · sesk.info/tech-git-bisect
A bug appeared sometime in your last 1,000 commits. What does git bisect do?
Binary search through the history to find the commit that introduced it.
- Deletes every commit after the bug
- Splits the repo into two copies
- Binary searches the commits to find the bad one ✔
Why: You mark one commit good and one bad. Git checks out the middle one and asks you which it is, halving the range each time, so 1,000 commits take only about 10 tests.
Huh, didn't know that: Bisect is binary search applied to debugging, the same O(log n) idea as searching a sorted list.
Git bisect helped me find who broke the build. It was me, ten commits ago.
Like this card?
References
Answer: Binary searches the commits to find the bad one. You mark one commit good and one bad. Git checks out the middle one and asks you which it is, halving the range each time, so 1,000 commits take only about 10 tests.
- Git documentation: git-bisect git-scm.com/docs/git-bisect
This command uses a binary search algorithm to find which commit in your project’s history introduced a bug.
Checked 2026-10-10.
Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.
More stuff everyone should know
That's stuff everyone should know.