Over at randyfay.com, Randy Fay has a great screencast on debugging with git bisect. If you’re not familiar with git’s bisect
command, the idea is to find the git
commit that introduced an error.
The process is basically a binary search. You have a commit with the error and find one without the error. Now you have the guilty commit bracketed and find it by dividing the commit space in half to find a new bracket end point, just as with a binary search. You could do that by hand, of course, but git
partially automates the process with the bisect
command.
The process is harder to describe than it is to do. Watch Fay’s screencast to see the bisect
command in action. Fay uses git
from the command line instead of magit or some other interface so you don’t have to be an Emacs user to profit from the video. If you are an Emacs user, magit has an interface to the bisect
command so you can have the best of both worlds.