@@ -16,9 +16,11 @@ DESCRIPTION
16
16
The command takes various subcommands, and different options depending
17
17
on the subcommand:
18
18
19
- git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
20
- git bisect bad [<rev>]
21
- git bisect good [<rev>...]
19
+ git bisect start [--term-{old,good}=<term> --term-{new,bad}=<term>]
20
+ [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
21
+ git bisect (bad|new) [<rev>]
22
+ git bisect (good|old) [<rev>...]
23
+ git bisect terms [--term-good | --term-bad]
22
24
git bisect skip [(<rev>|<range>)...]
23
25
git bisect reset [<commit>]
24
26
git bisect visualize
@@ -36,6 +38,13 @@ whether the selected commit is "good" or "bad". It continues narrowing
36
38
down the range until it finds the exact commit that introduced the
37
39
change.
38
40
41
+ In fact, `git bisect` can be used to find the commit that changed
42
+ *any* property of your project; e.g., the commit that fixed a bug, or
43
+ the commit that caused a benchmark's performance to improve. To
44
+ support this more general usage, the terms "old" and "new" can be used
45
+ in place of "good" and "bad", or you can choose your own terms. See
46
+ section "Alternate terms" below for more information.
47
+
39
48
Basic bisect commands: start, bad, good
40
49
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
50
@@ -111,6 +120,79 @@ bad revision, while `git bisect reset HEAD` will leave you on the
111
120
current bisection commit and avoid switching commits at all.
112
121
113
122
123
+ Alternate terms
124
+ ~~~~~~~~~~~~~~~
125
+
126
+ Sometimes you are not looking for the commit that introduced a
127
+ breakage, but rather for a commit that caused a change between some
128
+ other "old" state and "new" state. For example, you might be looking
129
+ for the commit that introduced a particular fix. Or you might be
130
+ looking for the first commit in which the source-code filenames were
131
+ finally all converted to your company's naming standard. Or whatever.
132
+
133
+ In such cases it can be very confusing to use the terms "good" and
134
+ "bad" to refer to "the state before the change" and "the state after
135
+ the change". So instead, you can use the terms "old" and "new",
136
+ respectively, in place of "good" and "bad". (But note that you cannot
137
+ mix "good" and "bad" with "old" and "new" in a single session.)
138
+
139
+ In this more general usage, you provide `git bisect` with a "new"
140
+ commit has some property and an "old" commit that doesn't have that
141
+ property. Each time `git bisect` checks out a commit, you test if that
142
+ commit has the property. If it does, mark the commit as "new";
143
+ otherwise, mark it as "old". When the bisection is done, `git bisect`
144
+ will report which commit introduced the property.
145
+
146
+ To use "old" and "new" instead of "good" and bad, you must run `git
147
+ bisect start` without commits as argument and then run the following
148
+ commands to add the commits:
149
+
150
+ ------------------------------------------------
151
+ git bisect old [<rev>]
152
+ ------------------------------------------------
153
+
154
+ to indicate that a commit was before the sought change, or
155
+
156
+ ------------------------------------------------
157
+ git bisect new [<rev>...]
158
+ ------------------------------------------------
159
+
160
+ to indicate that it was after.
161
+
162
+ To get a reminder of the currently used terms, use
163
+
164
+ ------------------------------------------------
165
+ git bisect terms
166
+ ------------------------------------------------
167
+
168
+ You can get just the old (respectively new) term with `git bisect term
169
+ --term-old` or `git bisect term --term-good`.
170
+
171
+ If you would like to use your own terms instead of "bad"/"good" or
172
+ "new"/"old", you can choose any names you like (except existing bisect
173
+ subcommands like `reset`, `start`, ...) by starting the
174
+ bisection using
175
+
176
+ ------------------------------------------------
177
+ git bisect start --term-old <term-old> --term-new <term-new>
178
+ ------------------------------------------------
179
+
180
+ For example, if you are looking for a commit that introduced a
181
+ performance regression, you might use
182
+
183
+ ------------------------------------------------
184
+ git bisect start --term-old fast --term-new slow
185
+ ------------------------------------------------
186
+
187
+ Or if you are looking for the commit that fixed a bug, you might use
188
+
189
+ ------------------------------------------------
190
+ git bisect start --term-new fixed --term-old broken
191
+ ------------------------------------------------
192
+
193
+ Then, use `git bisect <term-old>` and `git bisect <term-new>` instead
194
+ of `git bisect good` and `git bisect bad` to mark commits.
195
+
114
196
Bisect visualize
115
197
~~~~~~~~~~~~~~~~
116
198
@@ -387,6 +469,21 @@ In this case, when 'git bisect run' finishes, bisect/bad will refer to a commit
387
469
has at least one parent whose reachable graph is fully traversable in the sense
388
470
required by 'git pack objects'.
389
471
472
+ * Look for a fix instead of a regression in the code
473
+ +
474
+ ------------
475
+ $ git bisect start
476
+ $ git bisect new HEAD # current commit is marked as new
477
+ $ git bisect old HEAD~10 # the tenth commit from now is marked as old
478
+ ------------
479
+ +
480
+ or:
481
+ ------------
482
+ $ git bisect start --term-old broken --term-new fixed
483
+ $ git bisect fixed
484
+ $ git bisect broken HEAD~10
485
+ ------------
486
+
390
487
Getting help
391
488
~~~~~~~~~~~~
392
489
0 commit comments