git bisect Find the commit that introduced a bug

Does a binary search through history. You say which commit is bad and which was good, and Git checks out the middle one for you to test, halving the range each time.

Synopsis

git bisect start [BAD [GOOD]]
git bisect good | bad | skip
git bisect run COMMAND
git bisect reset

Common options

Option or formWhat it does
startBegin a bisect session
bad [COMMIT]Mark a commit (default: current) as having the bug
good [COMMIT]Mark a commit as working
run COMMANDTest automatically: exit 0 means good, 1 to 127 (except 125, which means skip) means bad
skipSkip a commit that cannot be tested
resetEnd the session and return to where you started

Examples

Start and mark the ends
git bisect start
git bisect bad
git bisect good v1.2.0
Bisecting: 14 revisions left to test after this (roughly 4 steps)
Mark the current commit after testing it
git bisect good
Let a script do the testing
git bisect run npm test
Finish and go back
git bisect reset

Notes

See also

Last reviewed 2026-10-09.