Reputation: 102723
I know that the tip of topic-branch-7 has a bug, and I know that the tip of master does not have the bug. I'd like to find out where the bug was introduced in topic-branch-7. So I've run the following:
git checkout topic-branch-7
# some testing to verify the bug
git bisect start bad # start a git bisect and mark this commit as bad
git-merge-base master topic-branch-7
9ac8c59bb10c13d86bcdeff90cb47e25d477caad
git checkout 9ac8c59bb10c13d86bcdeff90cb47e25d477caad
# some testing to verify the bug is not present
git bisect good
What's throwing me is that when I run git bisect good ... nothing happens! Isn't it supposed to mark the commit as good, find a midpoint between this commit and the bad commit, and do a checkout to that commit? Why is nothing happening?
Upvotes: 1
Views: 951
Reputation: 13398
I think you have the syntax for git bisect wrong. It should be
git-merge-base master topic-branch-7
9ac8c59bb10c13d86bcdeff90cb47e25d477caad
git bisect start topic-branch-7 9ac8c59bb10c13d86bcdeff90cb47e25d477caad
#you are now at a commit somewhere in between topic-branch-7 and 9ac8c59bb10c13d86bcdeff90cb47e25d477caad
#do testing to find out if bug is there
git bisect good/bad
#repeat until git tells you where the bug is introduced
git bisect reset HEAD
Upvotes: 2
Reputation: 2487
I know git bisect works nicely but what I like to do is do it manually by using branches. I select a commit that is good and create a branch, call it "good". Then I start by finding a commit in the middle and testing it. If it's good, then I create a branch on a commit between this one and the master, otherwise, I create a branch on a commit that's below the middle branch selected. This is done iteratively and is basically a binary sort. It means I check less commits and I have more fine control than bisect. Usually I use gitk to checkout to each of the branches. The other benefit is if you find something, you can work on a separate branch and not affect the rest. For example
Master Commit
.
.
.
Test Commit <---- This one is good, so keep selecting commits above until you fail
.
.
.
Middle Commit <--- Create branch and checkout. This one is good, so go above
.
.
.
Good Commit
Upvotes: 0