Skip to content

Instantly share code, notes, and snippets.

@thomasritz
Created September 14, 2012 14:24
Show Gist options
  • Save thomasritz/3722212 to your computer and use it in GitHub Desktop.
Save thomasritz/3722212 to your computer and use it in GitHub Desktop.
git bisect example session
# See man page http://git-scm.com/docs/git-bisect
# Start the bisect process
» git bisect start
# Mark current commit as bad
» git bisect bad
# Manually select a commit that worked. This may require some tries to find one.
» git checkout 37060ec22b7ac3f8a795df7fa1f5ce0579d58b4e
Note: checking out '37060ec22b7ac3f8a795df7fa1f5ce0579d58b4e'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 37060ec... asfasdfas
# Verify the current commit (for example: in the browser by reloading a page)
» touch tmp/restart.txt
# Mark the currently checkout commit as good. Have git choose a new commit to test between the good and the bad commit.
» git bisect good
Bisecting: 9 revisions left to test after this (roughly 3 steps)
[a0248fa00451165afe9db6833b82a17cfc6a2d5a] asfdasdfasd
# Again, verify the current commit
» touch tmp/restart.txt
# Rate this commit:
» git bisect bad
Bisecting: 4 revisions left to test after this (roughly 2 steps)
[88db7d0c9553da4fd3df852cc95fb5f5c00393ba] adfsdfgdsfgsd
# Again, verify the current commit
» touch tmp/restart.txt
# Rate this commit:
» git bisect good
Bisecting: 2 revisions left to test after this (roughly 1 step)
[498c3aa66485bce723dd1bb83a34d064758fdffd] adfgdgdfgsdf
# Again, verify the current commit
» touch tmp/restart.txt
# Rate this commit:
» git bisect good
Bisecting: 0 revisions left to test after this (roughly 1 step)
[d16712f70f693a7a211df1b4a1fdb3219e738543] asfasfasf
# Again, verify the current commit
» touch tmp/restart.txt
# Rate this commit:
» git bisect good
a0248fa00451165afe9db6833b82a17cfc6a2d5a is the first bad commit
commit a0248fa00451165afe9db6833b82a17cfc6a2d5a
Author: Some One <some.one@example.org>
Date: Fri Sep 14 11:29:15 2012 +0200
the commit message asfasfasd
# YOU FOUND THE COMMIT
# End bisect
» git bisect reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment