2005-09-08 02:26:23 +02:00
|
|
|
git-bisect(1)
|
|
|
|
=============
|
2005-08-23 10:49:47 +02:00
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2005-09-08 02:26:23 +02:00
|
|
|
git-bisect - Find the change that introduced a bug
|
2005-08-23 10:49:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2005-12-05 09:15:24 +01:00
|
|
|
'git bisect' <subcommand> <options>
|
2005-08-23 10:49:47 +02:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2005-12-05 09:15:24 +01:00
|
|
|
The command takes various subcommands, and different options
|
|
|
|
depending on the subcommand:
|
|
|
|
|
|
|
|
git bisect start [<paths>...]
|
|
|
|
git bisect bad <rev>
|
|
|
|
git bisect good <rev>
|
|
|
|
git bisect reset [<branch>]
|
|
|
|
git bisect visualize
|
|
|
|
git bisect replay <logfile>
|
|
|
|
git bisect log
|
|
|
|
|
2005-08-30 02:21:06 +02:00
|
|
|
This command uses 'git-rev-list --bisect' option to help drive
|
|
|
|
the binary search process to find which change introduced a bug,
|
|
|
|
given an old "good" commit object name and a later "bad" commit
|
|
|
|
object name.
|
2005-08-23 10:49:47 +02:00
|
|
|
|
2005-08-30 02:21:06 +02:00
|
|
|
The way you use it is:
|
2005-08-23 10:49:47 +02:00
|
|
|
|
2005-08-30 02:21:06 +02:00
|
|
|
------------------------------------------------
|
2005-12-05 09:15:24 +01:00
|
|
|
$ git bisect start
|
|
|
|
$ git bisect bad # Current version is bad
|
|
|
|
$ git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
|
|
|
|
# tested that was good
|
2005-08-30 02:21:06 +02:00
|
|
|
------------------------------------------------
|
2005-08-23 10:49:47 +02:00
|
|
|
|
2005-08-30 02:21:06 +02:00
|
|
|
When you give at least one bad and one good versions, it will
|
|
|
|
bisect the revision tree and say something like:
|
|
|
|
|
|
|
|
------------------------------------------------
|
|
|
|
Bisecting: 675 revisions left to test after this
|
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
and check out the state in the middle. Now, compile that kernel, and boot
|
|
|
|
it. Now, let's say that this booted kernel works fine, then just do
|
|
|
|
|
|
|
|
------------------------------------------------
|
2005-12-05 09:15:24 +01:00
|
|
|
$ git bisect good # this one is good
|
2005-08-30 02:21:06 +02:00
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
which will now say
|
|
|
|
|
|
|
|
------------------------------------------------
|
|
|
|
Bisecting: 337 revisions left to test after this
|
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
and you continue along, compiling that one, testing it, and depending on
|
|
|
|
whether it is good or bad, you say "git bisect good" or "git bisect bad",
|
|
|
|
and ask for the next bisection.
|
|
|
|
|
|
|
|
Until you have no more left, and you'll have been left with the first bad
|
|
|
|
kernel rev in "refs/bisect/bad".
|
|
|
|
|
|
|
|
Oh, and then after you want to reset to the original head, do a
|
|
|
|
|
|
|
|
------------------------------------------------
|
2005-12-05 09:15:24 +01:00
|
|
|
$ git bisect reset
|
2005-08-30 02:21:06 +02:00
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
to get back to the master branch, instead of being in one of the bisection
|
|
|
|
branches ("git bisect start" will do that for you too, actually: it will
|
|
|
|
reset the bisection state, and before it does that it checks that you're
|
|
|
|
not using some old bisection branch).
|
2005-08-23 10:49:47 +02:00
|
|
|
|
2005-08-30 22:51:01 +02:00
|
|
|
During the bisection process, you can say
|
|
|
|
|
2005-12-05 09:15:24 +01:00
|
|
|
------------
|
|
|
|
$ git bisect visualize
|
|
|
|
------------
|
2005-08-30 22:51:01 +02:00
|
|
|
|
|
|
|
to see the currently remaining suspects in `gitk`.
|
|
|
|
|
2005-10-06 00:08:26 +02:00
|
|
|
The good/bad input is logged, and `git bisect
|
2005-09-11 00:23:09 +02:00
|
|
|
log` shows what you have done so far. You can truncate its
|
|
|
|
output somewhere and save it in a file, and run
|
|
|
|
|
2005-12-05 09:15:24 +01:00
|
|
|
------------
|
|
|
|
$ git bisect replay that-file
|
|
|
|
------------
|
2005-09-11 00:23:09 +02:00
|
|
|
|
|
|
|
if you find later you made a mistake telling good/bad about a
|
|
|
|
revision.
|
|
|
|
|
2005-12-05 09:15:24 +01:00
|
|
|
If in a middle of bisect session, you know what the bisect
|
|
|
|
suggested to try next is not a good one to test (e.g. the change
|
|
|
|
the commit introduces is known not to work in your environment
|
|
|
|
and you know it does not have anything to do with the bug you
|
|
|
|
are chasing), you may want to find a near-by commit and try that
|
|
|
|
instead. It goes something like this:
|
|
|
|
|
|
|
|
------------
|
|
|
|
$ git bisect good/bad # previous round was good/bad.
|
|
|
|
Bisecting: 337 revisions left to test after this
|
|
|
|
$ git bisect visualize # oops, that is uninteresting.
|
|
|
|
$ git reset --hard HEAD~3 # try 3 revs before what
|
|
|
|
# was suggested
|
|
|
|
------------
|
|
|
|
|
|
|
|
Then compile and test the one you chose to try. After that,
|
|
|
|
tell bisect what the result was as usual.
|
|
|
|
|
|
|
|
You can further cut down the number of trials if you know what
|
|
|
|
part of the tree is involved in the problem you are tracking
|
|
|
|
down, by giving paths parameters when you say `bisect start`,
|
|
|
|
like this:
|
|
|
|
|
|
|
|
------------
|
|
|
|
$ git bisect start arch/i386 include/asm-i386
|
|
|
|
------------
|
|
|
|
|
2005-08-23 10:49:47 +02:00
|
|
|
|
|
|
|
Author
|
|
|
|
------
|
|
|
|
Written by Linus Torvalds <torvalds@osdl.org>
|
|
|
|
|
|
|
|
Documentation
|
2005-10-03 19:16:30 +02:00
|
|
|
-------------
|
2005-08-23 10:49:47 +02:00
|
|
|
Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
|
|
|
|
|
|
|
|
GIT
|
|
|
|
---
|
2005-09-19 12:10:51 +02:00
|
|
|
Part of the gitlink:git[7] suite
|
2005-08-23 10:49:47 +02:00
|
|
|
|