blob: 1ec14a068e750b114ac5f1ad2f468de8d0664a16 [file] [log] [blame]
Junio C Hamanob0e02952008-01-19 08:02:001Commit Limiting
2~~~~~~~~~~~~~~~
3
4Besides specifying a range of commits that should be listed using the
5special notations explained in the description, additional commit
Junio C Hamano8ce35d72012-09-18 22:30:426limiting may be applied.
7
8Using more options generally further limits the output (e.g.
9`--since=<date1>` limits to commits newer than `<date1>`, and using it
10with `--grep=<pattern>` further limits to commits whose log message
11has a line that matches `<pattern>`), unless otherwise noted.
12
13Note that these are applied before commit
14ordering and formatting options, such as `--reverse`.
Junio C Hamanob0e02952008-01-19 08:02:0015
16--
17
Junio C Hamano693e7092012-09-12 22:56:5318-<number>::
19-n <number>::
Junio C Hamanob4a9ede2009-04-08 07:36:3220--max-count=<number>::
Junio C Hamanob0e02952008-01-19 08:02:0021
Junio C Hamanoc5be4cc2011-03-09 07:20:4322Limit the number of commits to output.
Junio C Hamanob0e02952008-01-19 08:02:0023
Junio C Hamanob4a9ede2009-04-08 07:36:3224--skip=<number>::
Junio C Hamanob0e02952008-01-19 08:02:0025
26Skip 'number' commits before starting to show the commit output.
27
Junio C Hamanob4a9ede2009-04-08 07:36:3228--since=<date>::
29--after=<date>::
Junio C Hamanob0e02952008-01-19 08:02:0030
31Show commits more recent than a specific date.
32
Junio C Hamanob4a9ede2009-04-08 07:36:3233--until=<date>::
34--before=<date>::
Junio C Hamanob0e02952008-01-19 08:02:0035
36Show commits older than a specific date.
37
Junio C Hamano4f1d8c42008-03-03 02:01:1638ifdef::git-rev-list[]
Junio C Hamanob4a9ede2009-04-08 07:36:3239--max-age=<timestamp>::
40--min-age=<timestamp>::
Junio C Hamanob0e02952008-01-19 08:02:0041
42Limit the commits output to specified time range.
Junio C Hamano4f1d8c42008-03-03 02:01:1643endif::git-rev-list[]
Junio C Hamanob0e02952008-01-19 08:02:0044
Junio C Hamanob4a9ede2009-04-08 07:36:3245--author=<pattern>::
46--committer=<pattern>::
Junio C Hamanob0e02952008-01-19 08:02:0047
48Limit the commits output to ones with author/committer
Junio C Hamano8ce35d72012-09-18 22:30:4249header lines that match the specified pattern (regular
50expression). With more than one `--author=<pattern>`,
51commits whose author matches any of the given patterns are
52chosen (similarly for multiple `--committer=<pattern>`).
Junio C Hamanob0e02952008-01-19 08:02:0053
Junio C Hamano9954ed72012-10-03 04:54:0054--grep-reflog=<pattern>::
55
56Limit the commits output to ones with reflog entries that
57match the specified pattern (regular expression). With
58more than one `--grep-reflog`, commits whose reflog message
59matches any of the given patterns are chosen. It is an
60error to use this option unless `--walk-reflogs` is in use.
61
Junio C Hamanob4a9ede2009-04-08 07:36:3262--grep=<pattern>::
Junio C Hamanob0e02952008-01-19 08:02:0063
64Limit the commits output to ones with log message that
Junio C Hamano8ce35d72012-09-18 22:30:4265matches the specified pattern (regular expression). With
66more than one `--grep=<pattern>`, commits whose message
67matches any of the given patterns are chosen (but see
68`--all-match`).
Junio C Hamano9954ed72012-10-03 04:54:0069+
70When `--show-notes` is in effect, the message from the notes as
71if it is part of the log message.
Junio C Hamanob0e02952008-01-19 08:02:0072
Junio C Hamanoaa17c7c2008-11-03 04:36:5873--all-match::
74Limit the commits output to ones that match all given --grep,
Junio C Hamano8ce35d72012-09-18 22:30:4275instead of ones that match at least one.
Junio C Hamanoaa17c7c2008-11-03 04:36:5876
Junio C Hamanoeb415992008-06-08 22:49:4777-i::
78--regexp-ignore-case::
Junio C Hamanob0e02952008-01-19 08:02:0079
80Match the regexp limiting patterns without regard to letters case.
81
Junio C Hamanoa1295452012-11-13 22:32:0482--basic-regexp::
83
84Consider the limiting patterns to be basic regular expressions;
85this is the default.
86
Junio C Hamanoeb415992008-06-08 22:49:4787-E::
88--extended-regexp::
Junio C Hamanob0e02952008-01-19 08:02:0089
90Consider the limiting patterns to be extended regular expressions
91instead of the default basic regular expressions.
92
Junio C Hamanoeb415992008-06-08 22:49:4793-F::
94--fixed-strings::
Junio C Hamano24bc09a2008-02-28 00:27:4495
96Consider the limiting patterns to be fixed strings (don't interpret
97pattern as a regular expression).
98
Junio C Hamanoa1295452012-11-13 22:32:0499--perl-regexp::
100
101Consider the limiting patterns to be Perl-compatible regexp.
102Requires libpcre to be compiled in.
103
Junio C Hamanob0e02952008-01-19 08:02:00104--remove-empty::
105
106Stop when a given path disappears from the tree.
107
Junio C Hamano934e1782009-07-16 06:59:15108--merges::
109
Junio C Hamanof32ce262011-03-27 07:35:11110Print only merge commits. This is exactly the same as `--min-parents=2`.
Junio C Hamano934e1782009-07-16 06:59:15111
Junio C Hamanob0e02952008-01-19 08:02:00112--no-merges::
113
Junio C Hamanof32ce262011-03-27 07:35:11114Do not print commits with more than one parent. This is
115exactly the same as `--max-parents=1`.
116
117--min-parents=<number>::
118--max-parents=<number>::
119--no-min-parents::
120--no-max-parents::
121
122Show only commits which have at least (or at most) that many
123commits. In particular, `--max-parents=1` is the same as `--no-merges`,
124`--min-parents=2` is the same as `--merges`. `--max-parents=0`
125gives all root commits and `--min-parents=3` all octopus merges.
126+
127`--no-min-parents` and `--no-max-parents` reset these limits (to no limit)
128again. Equivalent forms are `--min-parents=0` (any commit has 0 or more
129parents) and `--max-parents=-1` (negative numbers denote no upper limit).
Junio C Hamanob0e02952008-01-19 08:02:00130
131--first-parent::
132Follow only the first parent commit upon seeing a merge
133commit. This option can give a better overview when
134viewing the evolution of a particular topic branch,
135because merges into a topic branch tend to be only about
136adjusting to updated upstream from time to time, and
137this option allows you to ignore the individual commits
138brought in to your history by such a merge.
139
140--not::
141
142Reverses the meaning of the '{caret}' prefix (or lack thereof)
143for all following revision specifiers, up to the next '--not'.
144
145--all::
146
Junio C Hamano4fdccb22010-02-19 09:58:14147Pretend as if all the refs in `refs/` are listed on the
Junio C Hamanob0e02952008-01-19 08:02:00148command line as '<commit>'.
149
Junio C Hamanod2179ef2010-10-22 04:12:17150--branches[=<pattern>]::
Junio C Hamano50819852008-11-19 02:07:56151
Junio C Hamano4fdccb22010-02-19 09:58:14152Pretend as if all the refs in `refs/heads` are listed
Junio C Hamanod2179ef2010-10-22 04:12:17153on the command line as '<commit>'. If '<pattern>' is given, limit
Junio C Hamano57827fb2010-01-23 03:02:50154branches to ones matching given shell glob. If pattern lacks '?',
Junio C Hamano81d540a2012-03-02 19:52:47155'{asterisk}', or '[', '/{asterisk}' at the end is implied.
Junio C Hamano50819852008-11-19 02:07:56156
Junio C Hamanod2179ef2010-10-22 04:12:17157--tags[=<pattern>]::
Junio C Hamano50819852008-11-19 02:07:56158
Junio C Hamano4fdccb22010-02-19 09:58:14159Pretend as if all the refs in `refs/tags` are listed
Junio C Hamanod2179ef2010-10-22 04:12:17160on the command line as '<commit>'. If '<pattern>' is given, limit
Junio C Hamano81d540a2012-03-02 19:52:47161tags to ones matching given shell glob. If pattern lacks '?', '{asterisk}',
162or '[', '/{asterisk}' at the end is implied.
Junio C Hamano50819852008-11-19 02:07:56163
Junio C Hamanod2179ef2010-10-22 04:12:17164--remotes[=<pattern>]::
Junio C Hamano50819852008-11-19 02:07:56165
Junio C Hamano4fdccb22010-02-19 09:58:14166Pretend as if all the refs in `refs/remotes` are listed
Junio C Hamanod2179ef2010-10-22 04:12:17167on the command line as '<commit>'. If '<pattern>' is given, limit
Junio C Hamano97bcb482010-11-25 03:16:07168remote-tracking branches to ones matching given shell glob.
Junio C Hamano81d540a2012-03-02 19:52:47169If pattern lacks '?', '{asterisk}', or '[', '/{asterisk}' at the end is implied.
Junio C Hamano57827fb2010-01-23 03:02:50170
Junio C Hamanod2179ef2010-10-22 04:12:17171--glob=<glob-pattern>::
172Pretend as if all the refs matching shell glob '<glob-pattern>'
Junio C Hamano57827fb2010-01-23 03:02:50173are listed on the command line as '<commit>'. Leading 'refs/',
Junio C Hamano81d540a2012-03-02 19:52:47174is automatically prepended if missing. If pattern lacks '?', '{asterisk}',
175or '[', '/{asterisk}' at the end is implied.
Junio C Hamano57827fb2010-01-23 03:02:50176
Junio C Hamano084228c2011-05-30 08:13:52177--ignore-missing::
178
179Upon seeing an invalid object name in the input, pretend as if
180the bad input was not given.
Junio C Hamano50819852008-11-19 02:07:56181
Junio C Hamano5706e0b2009-11-24 10:54:16182ifndef::git-rev-list[]
183--bisect::
184
Junio C Hamano4fdccb22010-02-19 09:58:14185Pretend as if the bad bisection ref `refs/bisect/bad`
Junio C Hamano5706e0b2009-11-24 10:54:16186was listed and as if it was followed by `--not` and the good
Junio C Hamano4fdccb22010-02-19 09:58:14187bisection refs `refs/bisect/good-*` on the command
Junio C Hamano5706e0b2009-11-24 10:54:16188line.
189endif::git-rev-list[]
190
Junio C Hamanob0e02952008-01-19 08:02:00191--stdin::
192
193In addition to the '<commit>' listed on the command
Junio C Hamano5706e0b2009-11-24 10:54:16194line, read them from the standard input. If a '--' separator is
195seen, stop reading commits and start reading paths to limit the
196result.
Junio C Hamanob0e02952008-01-19 08:02:00197
Junio C Hamano5706e0b2009-11-24 10:54:16198ifdef::git-rev-list[]
Junio C Hamanob0e02952008-01-19 08:02:00199--quiet::
200
201Don't print anything to standard output. This form
202is primarily meant to allow the caller to
203test the exit status to see if a range of objects is fully
204connected (or not). It is faster than redirecting stdout
205to /dev/null as the output does not have to be formatted.
Junio C Hamano69cd7c52008-06-04 07:52:59206endif::git-rev-list[]
Junio C Hamanob0e02952008-01-19 08:02:00207
Junio C Hamano9a2fb2d2011-03-23 05:40:15208--cherry-mark::
209
210Like `--cherry-pick` (see below) but mark equivalent commits
211with `=` rather than omitting them, and inequivalent ones with `+`.
212
Junio C Hamanob0e02952008-01-19 08:02:00213--cherry-pick::
214
215Omit any commit that introduces the same change as
216another commit on the "other side" when the set of
217commits are limited with symmetric difference.
218+
219For example, if you have two branches, `A` and `B`, a usual way
220to list all commits on only one side of them is with
Junio C Hamano5cd15182011-04-05 00:21:10221`--left-right` (see the example below in the description of
222the `--left-right` option). It however shows the commits that were cherry-picked
Junio C Hamanob0e02952008-01-19 08:02:00223from the other branch (for example, "3rd on b" may be cherry-picked
224from branch A). With this option, such pairs of commits are
225excluded from the output.
226
Junio C Hamano9a2fb2d2011-03-23 05:40:15227--left-only::
228--right-only::
229
230List only commits on the respective side of a symmetric range,
231i.e. only those which would be marked `<` resp. `>` by
232`--left-right`.
233+
234For example, `--cherry-pick --right-only A...B` omits those
235commits from `B` which are in `A` or are patch-equivalent to a commit in
Junio C Hamanob76a6862012-05-02 22:02:46236`A`. In other words, this lists the `+` commits from `git cherry A B`.
Junio C Hamano9a2fb2d2011-03-23 05:40:15237More precisely, `--cherry-pick --right-only --no-merges` gives the exact
238list.
239
240--cherry::
241
242A synonym for `--right-only --cherry-mark --no-merges`; useful to
243limit the output to the commits on our side and mark those that
244have been applied to the other side of a forked history with
245`git log --cherry upstream...mybranch`, similar to
246`git cherry upstream mybranch`.
247
Junio C Hamanoeb415992008-06-08 22:49:47248-g::
249--walk-reflogs::
Junio C Hamanob0e02952008-01-19 08:02:00250
251Instead of walking the commit ancestry chain, walk
252reflog entries from the most recent one to older ones.
253When this option is used you cannot specify commits to
254exclude (that is, '{caret}commit', 'commit1..commit2',
Junio C Hamano2db3e752010-09-03 21:33:06255nor 'commit1\...commit2' notations cannot be used).
Junio C Hamanob0e02952008-01-19 08:02:00256+
257With '\--pretty' format other than oneline (for obvious reasons),
258this causes the output to have two extra lines of information
259taken from the reflog. By default, 'commit@\{Nth}' notation is
260used in the output. When the starting commit is specified as
Junio C Hamano1d368882008-08-11 22:03:10261'commit@\{now}', output also uses 'commit@\{timestamp}' notation
Junio C Hamanob0e02952008-01-19 08:02:00262instead. Under '\--pretty=oneline', the commit message is
263prefixed with this information on the same line.
Junio C Hamano1d368882008-08-11 22:03:10264This option cannot be combined with '\--reverse'.
Junio C Hamanob0e02952008-01-19 08:02:00265See also linkgit:git-reflog[1].
266
267--merge::
268
269After a failed merge, show refs that touch files having a
270conflict and don't exist on all heads to merge.
271
272--boundary::
273
274Output uninteresting commits at the boundary, which are usually
275not shown.
276
Junio C Hamanoa76cb0d2008-08-13 20:04:10277--
278
279History Simplification
280~~~~~~~~~~~~~~~~~~~~~~
281
Junio C Hamano28363492008-11-14 08:26:31282Sometimes you are only interested in parts of the history, for example the
283commits modifying a particular <path>. But there are two parts of
284'History Simplification', one part is selecting the commits and the other
285is how to do it, as there are various strategies to simplify the history.
286
287The following options select the commits to be shown:
288
289<paths>::
290
291Commits modifying the given <paths> are selected.
292
293--simplify-by-decoration::
294
295Commits that are referred by some branch or tag are selected.
296
297Note that extra commits can be shown to give a meaningful history.
298
299The following options affect the way the simplification is performed:
300
301Default mode::
302
303Simplifies the history to the simplest history explaining the
304final state of the tree. Simplest because it prunes some side
305branches if the end result is the same (i.e. merging branches
306with the same content)
307
308--full-history::
309
Junio C Hamano15567bc2011-07-23 00:51:59310Same as the default mode, but does not prune some history.
Junio C Hamano28363492008-11-14 08:26:31311
312--dense::
313
314Only the selected commits are shown, plus some to have a
315meaningful history.
316
317--sparse::
318
319All commits in the simplified history are shown.
320
321--simplify-merges::
322
323Additional option to '--full-history' to remove some needless
324merges from the resulting history, as there are no selected
325commits contributing to this merge.
326
Junio C Hamano89a57342010-06-22 23:22:55327--ancestry-path::
328
329When given a range of commits to display (e.g. 'commit1..commit2'
330or 'commit2 {caret}commit1'), only display commits that exist
331directly on the ancestry chain between the 'commit1' and
332'commit2', i.e. commits that are both descendants of 'commit1',
333and ancestors of 'commit2'.
334
Junio C Hamano28363492008-11-14 08:26:31335A more detailed explanation follows.
Junio C Hamanoa76cb0d2008-08-13 20:04:10336
337Suppose you specified `foo` as the <paths>. We shall call commits
338that modify `foo` !TREESAME, and the rest TREESAME. (In a diff
339filtered for `foo`, they look different and equal, respectively.)
340
341In the following, we will always refer to the same example history to
342illustrate the differences between simplification settings. We assume
343that you are filtering for a file `foo` in this commit graph:
344-----------------------------------------------------------------------
345 .-A---M---N---O---P
346 / / / / /
347I B C D E
348 \ / / / /
349 `-------------'
350-----------------------------------------------------------------------
Junio C Hamano360e3a12011-07-13 23:51:56351The horizontal line of history A---P is taken to be the first parent of
Junio C Hamanoa76cb0d2008-08-13 20:04:10352each merge. The commits are:
353
354* `I` is the initial commit, in which `foo` exists with contents
355 "asdf", and a file `quux` exists with contents "quux". Initial
356 commits are compared to an empty tree, so `I` is !TREESAME.
357
358* In `A`, `foo` contains just "foo".
359
360* `B` contains the same change as `A`. Its merge `M` is trivial and
361 hence TREESAME to all parents.
362
363* `C` does not change `foo`, but its merge `N` changes it to "foobar",
364 so it is not TREESAME to any parent.
365
366* `D` sets `foo` to "baz". Its merge `O` combines the strings from
367 `N` and `D` to "foobarbaz"; i.e., it is not TREESAME to any parent.
368
369* `E` changes `quux` to "xyzzy", and its merge `P` combines the
370 strings to "quux xyzzy". Despite appearing interesting, `P` is
371 TREESAME to all parents.
372
373'rev-list' walks backwards through history, including or excluding
374commits based on whether '\--full-history' and/or parent rewriting
375(via '\--parents' or '\--children') are used. The following settings
376are available.
377
378Default mode::
379
380Commits are included if they are not TREESAME to any parent
381(though this can be changed, see '\--sparse' below). If the
382commit was a merge, and it was TREESAME to one parent, follow
383only that parent. (Even if there are several TREESAME
384parents, follow only one of them.) Otherwise, follow all
385parents.
386+
387This results in:
388+
389-----------------------------------------------------------------------
390 .-A---N---O
Junio C Hamano89a57342010-06-22 23:22:55391 / / /
Junio C Hamanoa76cb0d2008-08-13 20:04:10392I---------D
393-----------------------------------------------------------------------
394+
395Note how the rule to only follow the TREESAME parent, if one is
396available, removed `B` from consideration entirely. `C` was
397considered via `N`, but is TREESAME. Root commits are compared to an
398empty tree, so `I` is !TREESAME.
399+
400Parent/child relations are only visible with --parents, but that does
401not affect the commits selected in default mode, so we have shown the
402parent lines.
403
404--full-history without parent rewriting::
405
406This mode differs from the default in one point: always follow
407all parents of a merge, even if it is TREESAME to one of them.
408Even if more than one side of the merge has commits that are
409included, this does not imply that the merge itself is! In
410the example, we get
411+
412-----------------------------------------------------------------------
413I A B N D O
414-----------------------------------------------------------------------
415+
416`P` and `M` were excluded because they are TREESAME to a parent. `E`,
417`C` and `B` were all walked, but only `B` was !TREESAME, so the others
418do not appear.
419+
420Note that without parent rewriting, it is not really possible to talk
421about the parent/child relationships between the commits, so we show
422them disconnected.
423
424--full-history with parent rewriting::
425
426Ordinary commits are only included if they are !TREESAME
427(though this can be changed, see '\--sparse' below).
428+
429Merges are always included. However, their parent list is rewritten:
430Along each parent, prune away commits that are not included
431themselves. This results in
432+
433-----------------------------------------------------------------------
434 .-A---M---N---O---P
435 / / / / /
436I B / D /
437 \ / / / /
438 `-------------'
439-----------------------------------------------------------------------
440+
441Compare to '\--full-history' without rewriting above. Note that `E`
442was pruned away because it is TREESAME, but the parent list of P was
443rewritten to contain `E`'s parent `I`. The same happened for `C` and
444`N`. Note also that `P` was included despite being TREESAME.
445
446In addition to the above settings, you can change whether TREESAME
447affects inclusion:
448
Junio C Hamanoeb415992008-06-08 22:49:47449--dense::
Junio C Hamanoa76cb0d2008-08-13 20:04:10450
451Commits that are walked are included if they are not TREESAME
452to any parent.
453
Junio C Hamanoeb415992008-06-08 22:49:47454--sparse::
Junio C Hamanob0e02952008-01-19 08:02:00455
Junio C Hamanoa76cb0d2008-08-13 20:04:10456All commits that are walked are included.
457+
458Note that without '\--full-history', this still simplifies merges: if
459one of the parents is TREESAME, we follow only that one, so the other
460sides of the merge are never walked.
Junio C Hamanob0e02952008-01-19 08:02:00461
Junio C Hamanoa2f46622008-09-03 05:20:31462--simplify-merges::
463
464First, build a history graph in the same way that
465'\--full-history' with parent rewriting does (see above).
466+
467Then simplify each commit `C` to its replacement `C'` in the final
468history according to the following rules:
469+
470--
471* Set `C'` to `C`.
472+
473* Replace each parent `P` of `C'` with its simplification `P'`. In
474 the process, drop parents that are ancestors of other parents, and
475 remove duplicates.
476+
477* If after this parent rewriting, `C'` is a root or merge commit (has
478 zero or >1 parents), a boundary commit, or !TREESAME, it remains.
479 Otherwise, it is replaced with its only parent.
480--
481+
482The effect of this is best shown by way of comparing to
483'\--full-history' with parent rewriting. The example turns into:
484+
485-----------------------------------------------------------------------
486 .-A---M---N---O
487 / / /
488I B D
489 \ / /
490 `---------'
491-----------------------------------------------------------------------
492+
Junio C Hamanob76a6862012-05-02 22:02:46493Note the major differences in `N` and `P` over '--full-history':
Junio C Hamanoa2f46622008-09-03 05:20:31494+
495--
496* `N`'s parent list had `I` removed, because it is an ancestor of the
497 other parent `M`. Still, `N` remained because it is !TREESAME.
498+
499* `P`'s parent list similarly had `I` removed. `P` was then
500 removed completely, because it had one parent and is TREESAME.
501--
Junio C Hamanob0e02952008-01-19 08:02:00502
Junio C Hamano89a57342010-06-22 23:22:55503Finally, there is a fifth simplification mode available:
504
505--ancestry-path::
506
507Limit the displayed commits to those directly on the ancestry
508chain between the "from" and "to" commits in the given commit
509range. I.e. only display commits that are ancestor of the "to"
510commit, and descendants of the "from" commit.
511+
512As an example use case, consider the following commit history:
513+
514-----------------------------------------------------------------------
515 D---E-------F
516 / \ \
517 B---C---G---H---I---J
518 / \
519A-------K---------------L--M
520-----------------------------------------------------------------------
521+
522A regular 'D..M' computes the set of commits that are ancestors of `M`,
523but excludes the ones that are ancestors of `D`. This is useful to see
524what happened to the history leading to `M` since `D`, in the sense
525that "what does `M` have that did not exist in `D`". The result in this
526example would be all the commits, except `A` and `B` (and `D` itself,
527of course).
528+
529When we want to find out what commits in `M` are contaminated with the
530bug introduced by `D` and need fixing, however, we might want to view
531only the subset of 'D..M' that are actually descendants of `D`, i.e.
Junio C Hamanob76a6862012-05-02 22:02:46532excluding `C` and `K`. This is exactly what the '--ancestry-path'
Junio C Hamano89a57342010-06-22 23:22:55533option does. Applied to the 'D..M' range, it results in:
534+
535-----------------------------------------------------------------------
536E-------F
537 \ \
538 G---H---I---J
539 \
540L--M
541-----------------------------------------------------------------------
542
Junio C Hamano28363492008-11-14 08:26:31543The '\--simplify-by-decoration' option allows you to view only the
544big picture of the topology of the history, by omitting commits
545that are not referenced by tags. Commits are marked as !TREESAME
546(in other words, kept after history simplification rules described
547above) if (1) they are referenced by tags, or (2) they change the
548contents of the paths given on the command line. All other
549commits are marked as TREESAME (subject to be simplified away).
550
Junio C Hamanob0e02952008-01-19 08:02:00551ifdef::git-rev-list[]
Junio C Hamanoa76cb0d2008-08-13 20:04:10552Bisection Helpers
553~~~~~~~~~~~~~~~~~
554
Junio C Hamanob0e02952008-01-19 08:02:00555--bisect::
556
557Limit output to the one commit object which is roughly halfway between
Junio C Hamano5706e0b2009-11-24 10:54:16558included and excluded commits. Note that the bad bisection ref
Junio C Hamano4fdccb22010-02-19 09:58:14559`refs/bisect/bad` is added to the included commits (if it
560exists) and the good bisection refs `refs/bisect/good-*` are
Junio C Hamano5706e0b2009-11-24 10:54:16561added to the excluded commits (if they exist). Thus, supposing there
Junio C Hamano4fdccb22010-02-19 09:58:14562are no refs in `refs/bisect/`, if
Junio C Hamanob0e02952008-01-19 08:02:00563
564-----------------------------------------------------------------------
Junio C Hamano175a1bd2008-11-10 00:08:57565$ git rev-list --bisect foo ^bar ^baz
Junio C Hamanob0e02952008-01-19 08:02:00566-----------------------------------------------------------------------
567
568outputs 'midpoint', the output of the two commands
569
570-----------------------------------------------------------------------
Junio C Hamano175a1bd2008-11-10 00:08:57571$ git rev-list foo ^midpoint
572$ git rev-list midpoint ^bar ^baz
Junio C Hamanob0e02952008-01-19 08:02:00573-----------------------------------------------------------------------
574
575would be of roughly the same length. Finding the change which
576introduces a regression is thus reduced to a binary search: repeatedly
577generate and test new 'midpoint's until the commit chain is of length
578one.
579
580--bisect-vars::
581
Junio C Hamano5706e0b2009-11-24 10:54:16582This calculates the same as `--bisect`, except that refs in
Junio C Hamano4fdccb22010-02-19 09:58:14583`refs/bisect/` are not used, and except that this outputs
Junio C Hamano5706e0b2009-11-24 10:54:16584text ready to be eval'ed by the shell. These lines will assign the
585name of the midpoint revision to the variable `bisect_rev`, and the
586expected number of commits to be tested after `bisect_rev` is tested
587to `bisect_nr`, the expected number of commits to be tested if
588`bisect_rev` turns out to be good to `bisect_good`, the expected
589number of commits to be tested if `bisect_rev` turns out to be bad to
590`bisect_bad`, and the number of commits we are bisecting right now to
591`bisect_all`.
Junio C Hamanob0e02952008-01-19 08:02:00592
593--bisect-all::
594
595This outputs all the commit objects between the included and excluded
596commits, ordered by their distance to the included and excluded
Junio C Hamano4fdccb22010-02-19 09:58:14597commits. Refs in `refs/bisect/` are not used. The farthest
Junio C Hamano5706e0b2009-11-24 10:54:16598from them is displayed first. (This is the only one displayed by
599`--bisect`.)
Junio C Hamano792c5a92009-03-08 08:45:13600+
Junio C Hamanob0e02952008-01-19 08:02:00601This is useful because it makes it easy to choose a good commit to
602test when you want to avoid to test some of them for some reason (they
603may not compile for example).
Junio C Hamano792c5a92009-03-08 08:45:13604+
Junio C Hamanob0e02952008-01-19 08:02:00605This option can be used along with `--bisect-vars`, in this case,
606after all the sorted commit objects, there will be the same text as if
607`--bisect-vars` had been used alone.
608endif::git-rev-list[]
609
Junio C Hamanob0e02952008-01-19 08:02:00610
611Commit Ordering
612~~~~~~~~~~~~~~~
613
614By default, the commits are shown in reverse chronological order.
615
Junio C Hamanob0e02952008-01-19 08:02:00616--date-order::
Junio C Hamanod0316112012-08-22 19:55:29617Show no parents before all of its children are shown, but
618otherwise show commits in the commit timestamp order.
Junio C Hamanob0e02952008-01-19 08:02:00619
Junio C Hamanod0316112012-08-22 19:55:29620--topo-order::
621Show no parents before all of its children are shown, and
622avoid showing commits on multiple lines of history
623intermixed.
624+
625For example, in a commit history like this:
626+
627----------------------------------------------------------------
628
629 ---1----2----4----7
630\ \
631 3----5----6----8---
632
633----------------------------------------------------------------
634+
635where the numbers denote the order of commit timestamps, `git
636rev-list` and friends with `--date-order` show the commits in the
637timestamp order: 8 7 6 5 4 3 2 1.
638+
639With `--topo-order`, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5
6403 1); some older commits are shown before newer ones in order to
641avoid showing the commits from two parallel development track mixed
642together.
Junio C Hamanob0e02952008-01-19 08:02:00643
644--reverse::
645
646Output the commits in reverse order.
647Cannot be combined with '\--walk-reflogs'.
648
649Object Traversal
650~~~~~~~~~~~~~~~~
651
652These options are mostly targeted for packing of git repositories.
653
654--objects::
655
656Print the object IDs of any object referenced by the listed
657commits. '--objects foo ^bar' thus means "send me
658all object IDs which I need to download if I have the commit
659object 'bar', but not 'foo'".
660
661--objects-edge::
662
663Similar to '--objects', but also print the IDs of excluded
664commits prefixed with a "-" character. This is used by
665linkgit:git-pack-objects[1] to build "thin" pack, which records
666objects in deltified form based on objects contained in these
667excluded commits to reduce network traffic.
668
669--unpacked::
670
671Only useful with '--objects'; print the object IDs that are not
672in packs.
673
Junio C Hamanoeccdd4a2012-09-10 23:28:17674--no-walk[=(sorted|unsorted)]::
Junio C Hamanob0e02952008-01-19 08:02:00675
Junio C Hamanoeccdd4a2012-09-10 23:28:17676Only show the given commits, but do not traverse their ancestors.
677This has no effect if a range is specified. If the argument
678"unsorted" is given, the commits are show in the order they were
679given on the command line. Otherwise (if "sorted" or no argument
680was given), the commits are show in reverse chronological order
681by commit time.
Junio C Hamanob0e02952008-01-19 08:02:00682
683--do-walk::
684
685Overrides a previous --no-walk.
Junio C Hamanod2c978f2011-03-20 19:42:22686
687Commit Formatting
688~~~~~~~~~~~~~~~~~
689
690ifdef::git-rev-list[]
691Using these options, linkgit:git-rev-list[1] will act similar to the
692more specialized family of commit log tools: linkgit:git-log[1],
693linkgit:git-show[1], and linkgit:git-whatchanged[1]
694endif::git-rev-list[]
695
696include::pretty-options.txt[]
697
698--relative-date::
699
700Synonym for `--date=relative`.
701
702--date=(relative|local|default|iso|rfc|short|raw)::
703
704Only takes effect for dates shown in human-readable format, such
705as when using "--pretty". `log.date` config variable sets a default
706value for log command's --date option.
707+
708`--date=relative` shows dates relative to the current time,
709e.g. "2 hours ago".
710+
711`--date=local` shows timestamps in user's local timezone.
712+
713`--date=iso` (or `--date=iso8601`) shows timestamps in ISO 8601 format.
714+
715`--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822
716format, often found in E-mail messages.
717+
718`--date=short` shows only date but not time, in `YYYY-MM-DD` format.
719+
720`--date=raw` shows the date in the internal raw git format `%s %z` format.
721+
722`--date=default` shows timestamps in the original timezone
723(either committer's or author's).
724
725ifdef::git-rev-list[]
726--header::
727
728Print the contents of the commit in raw-format; each record is
729separated with a NUL character.
730endif::git-rev-list[]
731
732--parents::
733
734Print also the parents of the commit (in the form "commit parent...").
735Also enables parent rewriting, see 'History Simplification' below.
736
737--children::
738
739Print also the children of the commit (in the form "commit child...").
740Also enables parent rewriting, see 'History Simplification' below.
741
742ifdef::git-rev-list[]
743--timestamp::
744Print the raw commit timestamp.
745endif::git-rev-list[]
746
747--left-right::
748
749Mark which side of a symmetric diff a commit is reachable from.
750Commits from the left side are prefixed with `<` and those from
751the right with `>`. If combined with `--boundary`, those
752commits are prefixed with `-`.
753+
754For example, if you have this topology:
755+
756-----------------------------------------------------------------------
757 y---b---b branch B
758 / \ /
759 / .
760 / / \
761 o---x---a---a branch A
762-----------------------------------------------------------------------
763+
764you would get an output like this:
765+
766-----------------------------------------------------------------------
767$ git rev-list --left-right --boundary --pretty=oneline A...B
768
769>bbbbbbb... 3rd on b
770>bbbbbbb... 2nd on b
771<aaaaaaa... 3rd on a
772<aaaaaaa... 2nd on a
773-yyyyyyy... 1st on b
774-xxxxxxx... 1st on a
775-----------------------------------------------------------------------
776
777--graph::
778
779Draw a text-based graphical representation of the commit history
780on the left hand side of the output. This may cause extra lines
781to be printed in between commits, in order for the graph history
782to be drawn properly.
783+
784This enables parent rewriting, see 'History Simplification' below.
785+
786This implies the '--topo-order' option by default, but the
787'--date-order' option may also be specified.
788
789ifdef::git-rev-list[]
790--count::
791Print a number stating how many commits would have been
792listed, and suppress all other output. When used together
793with '--left-right', instead print the counts for left and
Junio C Hamanob77f8192011-05-05 01:30:38794right commits, separated by a tab. When used together with
795'--cherry-mark', omit patch equivalent commits from these
796counts and print the count for equivalent commits separated
797by a tab.
Junio C Hamanod2c978f2011-03-20 19:42:22798endif::git-rev-list[]
799
800
801ifndef::git-rev-list[]
802Diff Formatting
803~~~~~~~~~~~~~~~
804
805Below are listed options that control the formatting of diff output.
806Some of them are specific to linkgit:git-rev-list[1], however other diff
807options may be given. See linkgit:git-diff-files[1] for more options.
808
809-c::
810
811With this option, diff output for a merge commit
812shows the differences from each of the parents to the merge result
813simultaneously instead of showing pairwise diff between a parent
814and the result one at a time. Furthermore, it lists only files
815which were modified from all parents.
816
817--cc::
818
Junio C Hamano44dcd492012-07-24 04:35:38819This flag implies the '-c' option and further compresses the
Junio C Hamanod2c978f2011-03-20 19:42:22820patch output by omitting uninteresting hunks whose contents in
821the parents have only two variants and the merge result picks
822one of them without modification.
823
824-m::
825
826This flag makes the merge commits show the full diff like
827regular commits; for each merge parent, a separate log entry
828and diff is generated. An exception is that only diff against
829the first parent is shown when '--first-parent' option is given;
830in that case, the output represents the changes the merge
831brought _into_ the then-current branch.
832
833-r::
834
835Show recursive diffs.
836
837-t::
838
839Show the tree objects in the diff output. This implies '-r'.
840
841-s::
842Suppress diff output.
843endif::git-rev-list[]