Find the commit that broke things with git bisect

Binary search through history, so 200 commits take 8 steps.

SNP 128 #294 Filed git

shell
git bisect start
git bisect bad                 # the current commit is broken
git bisect good v2.3.0         # this one was fine

Git checks out the middle commit. Test it, then tell git:

shell
git bisect good   # or
git bisect bad

Repeat until it names the first bad commit. Then:

shell
git bisect reset

If a script can tell good from bad (exit 0 for good), let git do the whole thing:

shell
git bisect run npm test

Works with any command, git bisect run ./check.sh included. It's also a great argument for small commits: a bisect that lands on a 3,000-line commit hasn't told you much.