Bisect: Hunting Down Bad Commits
Use git bisect to perform a binary search through history and pinpoint the exact commit that introduced a bug, even across hundreds of commits.
The Needle in the Haystack
A bug hides somewhere in your last 200 commits. git bisect runs a binary search through history, halving the suspect range with each test.
How Binary Search Helps
Checking 200 commits linearly means 200 tests. Binary search needs only about log2(200) ≈ 8 — bisect narrows the culprit dramatically faster.
All lessons in this course
- Interactive Rebase and Amending
- Stashing and Cherry-picking Changes
- Reflog for Recovery
- Bisect: Hunting Down Bad Commits