Command Reference
git bisect
Use binary search across history to locate the commit that introduced a regression, making it one of the most valuable debugging commands in Git.
git bisect helps you find the first bad commit by repeatedly cutting the search space in half.
Basic flow
git bisect start
git bisect bad
git bisect good <good-commit>
Git then checks out midpoint commits and asks you to classify them as good or bad until the culprit is isolated.
Best use cases
- regressions with a clear good/bad outcome
- large history ranges that are too expensive to inspect manually
- bugs with a reproducible test or verification step
Important caution
Because bisect moves through many commits, always end with:
git bisect reset
The command is most powerful when your test step is stable and repeatable.
Read reference movement history, which makes reflog one of the most important commands for recovery after reset, rebase, and branch mistakes.
Nextgit blameTrack which commit last changed each line in a file, making it useful for recovering context around why a line looks the way it does now.