Best of Git
git bisect
If you have an atomically-versioned commit history, you will be happy to know that the most powerful git command is going to save you a lot of time.
Exhibit A: I just realized there is a bug in my program, for some particular edge-case functionality. How do I find when this bug came up, and what code caused it?
First, I could manually step through the history and see when it came up.
Second, I could use git bisect
.
Now, the process starts. You can hit good
or bad
on each
commit that comes up, or automate it(!):
This is a script I have to go through the build-and-test process automatically. An exit code of 125 will cause bisect to skip the commit (meaning it is due to a different issue than the main bug), so in this case, compiler errors aren’t important.
Then, git bisect will find which commit caused the
binary to fail on the test case (here: cuwarp.in
).
Leave a comment