Git Reference
Git Reference / Bisect

14Bisect

Binary-search your history to find the exact commit that introduced a bug. 1,000 commits → about 10 steps.

Manual

Git checks out the midpoint; you test and report.

git bisect start
git bisect bad              # current commit is broken
git bisect good v2.1.0      # this one worked
# ...test, then:
git bisect good   # or: git bisect bad
git bisect reset

Automated

Let a script decide — exit 0 = good, non-zero = bad.

git bisect start HEAD v2.1.0
git bisect run npm test
git bisect skip   # if a commit can't be tested
git bisect log