To begin a git bisect, the first command is:
git bisect startAfter this, you must tell git a bad and a good commit:
git bisect bad # or git bisect bad HEADIn this example, the HEAD is broken and that 10 commits before the HEAD is a good point.
git bisect good HEAD~10
Git will then begin the binary search and ask you about the state (good/bad) of the current revision.
You tell this by running:
git bisect goodor
git bisect badAt the end, git will tell you the commit that introduced the issue.
In order to stop the git bisect you must run:
git bisect resetYou should run this command after finishing the search.
Finally, if you have a script that returns 0 if a commit is good and a non-zero result otherwise, you can find out the bad commit in 2 lines:
git bisect HEAD last_good_revision
git bisect run ./script.sh
References:
http://git-scm.com/book/en/Git-Tools-Debugging-with-Git
No comments:
Post a Comment