Skip to main content

Debugging with git-bisect

My coworker Justin recently worked on a mysterious bug. No one has directly touched the codes in that area for a long time and no one understands what's going on either because the original author had left the company.

Upon discovering that this bug is a regression which just started failing two weeks ago and that he was able to reproduce the failure, he used git-bisect to do a binary search between a "bad" commit (where the bug exists in this version) and a "good" commit (where the version is working correctly) and very quickly found the culprit.

You basically just tell git-bisect if the current commit is good or bad in each binary search step and it'll narrow down the search to half of the commits. For more detailed information on the usage of git-bisect, check out the official documentation.
https://git-scm.com/docs/git-bisect

Anyways I liked the debugging story so much and hence wrote this quick note.




Comments