Git is a complex management system but powerful. Sometimes you need to figure out some weird problems. You can read the paragraph if you want to find someone broke the code.
Using bisect
to find the compiled error commit
You already knowed which committed was good and which committed was bad. That’s try to find out what the problem. Just type
$ git bisect start
$ git bisect good <good commit id>
$ git bisect bad <bad commit id>
Git will help you to checkout each commit for testing the code when you mark the commit is bad
$ make
gcc ... Error 1
$ git bisect bad
How to use script to find the compiled error
You can write the following script to help you find out the bad commit. If compiled error that the script response 1
and vice versa.
1 | !/bin/sh |
How to use script for bisect
Use git bisect run
for running the script.
$ git bisect start
$ git bisect good <good commit id>
$ git bisect bad <bad commit id>
$ git bisect run ./find_compile_error.sh
Now you can send the mail to someone, notice him/her to fix the problem.
If you want to exit bisect
, just type
$ git bisect reset