Semi-automatically find a faulty commit
suggest changeImagine you are on master and something no longer works, but you do not know which commit broke it. You do know it worked in the last release (a tag or a commit; call it old-rel).
Git has help for you, finding the faulty commit which introduced the regression with a very low number of steps (binary search).
First of all start bisecting:
git bisect start master old-rel
This marks master as bad and old-rel as good.
Git checks out a detached HEAD at a commit between them. Test that commit. If it works, run:
git bisect good
or
git bisect bad
If this commit cannot be tested, run git bisect skip and Git will choose another one.
After a few steps git will output the faulty commit hash.
In order to abort the bisect process just issue
git bisect reset
and git will restore the previous state.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents