6 git-bisect - Find the change that introduced a bug
12 'git bisect' bad <rev>
13 'git bisect' good <rev>
14 'git bisect' reset [<branch>]
15 'git bisect' visualize
16 'git bisect' replay <logfile>
21 This command uses 'git-rev-list --bisect' option to help drive
22 the binary search process to find which change introduced a bug,
23 given an old "good" commit object name and a later "bad" commit
26 The way you use it is:
28 ------------------------------------------------
30 git bisect bad # Current version is bad
31 git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
32 # tested that was good
33 ------------------------------------------------
35 When you give at least one bad and one good versions, it will
36 bisect the revision tree and say something like:
38 ------------------------------------------------
39 Bisecting: 675 revisions left to test after this
40 ------------------------------------------------
42 and check out the state in the middle. Now, compile that kernel, and boot
43 it. Now, let's say that this booted kernel works fine, then just do
45 ------------------------------------------------
46 git bisect good # this one is good
47 ------------------------------------------------
51 ------------------------------------------------
52 Bisecting: 337 revisions left to test after this
53 ------------------------------------------------
55 and you continue along, compiling that one, testing it, and depending on
56 whether it is good or bad, you say "git bisect good" or "git bisect bad",
57 and ask for the next bisection.
59 Until you have no more left, and you'll have been left with the first bad
60 kernel rev in "refs/bisect/bad".
62 Oh, and then after you want to reset to the original head, do a
64 ------------------------------------------------
66 ------------------------------------------------
68 to get back to the master branch, instead of being in one of the bisection
69 branches ("git bisect start" will do that for you too, actually: it will
70 reset the bisection state, and before it does that it checks that you're
71 not using some old bisection branch).
73 During the bisection process, you can say
77 to see the currently remaining suspects in `gitk`.
79 The good/bad you told the command is logged, and `git bisect
80 log` shows what you have done so far. You can truncate its
81 output somewhere and save it in a file, and run
83 git bisect replay that-file
85 if you find later you made a mistake telling good/bad about a
91 Written by Linus Torvalds <torvalds@osdl.org>
95 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
99 Part of the link:git.html[git] suite