Skip to main content
Git

Git bisect: find the breaking commit without guessing

Git bisect performs a binary search through history. Give it one known-good commit and one bad commit, then test each midpoint until the regression has a name.

Thien Nguyen
By Thien Nguyen
Updated June 29, 2026 · 1 min read

Reading fifty commits in order is optional. git bisect cuts the search space in half after every answer.

git bisect start
git bisect bad HEAD
git bisect good v2.4.0
# test, then: git bisect good | git bisect bad
git bisect reset

Short answer: choose a reproducible failing test, mark a known bad and known good revision, then let Git select midpoints. Automate the test with git bisect run when possible.

If a midpoint cannot be tested, use git bisect skip; too many skips reduce the certainty of the result.

The valuable output is not merely a commit hash—it is a small, reviewable change with a clear regression test.

Cover photo by Stanislav Kondratiev on Pexels.

References

Primary documentation and specifications checked when this article was last updated.

GitDebuggingWorkflow

Related articles

All articles