git bisect


Used to do binary search backwards to detect a regression

  1. git bisect start
  2. Assuming the current commit is bad, git bisect bad
  3. Then, git bisect good <last good sha1> with the SHA1 of the last commit you know works
  4. Git will keep checking out commits using binary search. Run your tests and run git bisect good/bad every time
  5. Once you figure out the issue, run git bisect reset so you're not in a weird state.

This can also be automated! See the Pro Git book for more details.