blob: 5bdfb4285247770722434541700b0f7547e3a113 [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
Junio C Hamanoc5bb3b32013-08-05 22:43:36122Show only commits which have at least (or at most) that many parent
Junio C Hamanof32ce262011-03-27 07:35:11123commits. 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
Junio C Hamano27159f82013-06-14 17:19:22274Output excluded boundary commits. Boundary commits are
275prefixed with `-`.
Junio C Hamanob0e02952008-01-19 08:02:00276
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-----------------------------------------------------------------------
Junio C Hamano27159f82013-06-14 17:19:22345 .-A---M---N---O---P---Q
346 / / / / / /
347I B C D E Y
348 \ / / / / /
349 `-------------' X
Junio C Hamanoa76cb0d2008-08-13 20:04:10350-----------------------------------------------------------------------
Junio C Hamano27159f82013-06-14 17:19:22351The horizontal line of history A---Q 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
Junio C Hamano27159f82013-06-14 17:19:22370 strings to "quux xyzzy". `P` is TREESAME to `O`, but not to `E`.
371
Junio C Hamanod7fccbf2013-07-25 03:24:57372* `X` is an independent root commit that added a new file `side`, and `Y`
Junio C Hamano27159f82013-06-14 17:19:22373 modified it. `Y` is TREESAME to `X`. Its merge `Q` added `side` to `P`, and
374 `Q` is TREESAME to `P`, but not to `Y`.
Junio C Hamanoa76cb0d2008-08-13 20:04:10375
376'rev-list' walks backwards through history, including or excluding
377commits based on whether '\--full-history' and/or parent rewriting
378(via '\--parents' or '\--children') are used. The following settings
379are available.
380
381Default mode::
382
383Commits are included if they are not TREESAME to any parent
384(though this can be changed, see '\--sparse' below). If the
385commit was a merge, and it was TREESAME to one parent, follow
386only that parent. (Even if there are several TREESAME
387parents, follow only one of them.) Otherwise, follow all
388parents.
389+
390This results in:
391+
392-----------------------------------------------------------------------
393 .-A---N---O
Junio C Hamano89a57342010-06-22 23:22:55394 / / /
Junio C Hamanoa76cb0d2008-08-13 20:04:10395I---------D
396-----------------------------------------------------------------------
397+
398Note how the rule to only follow the TREESAME parent, if one is
399available, removed `B` from consideration entirely. `C` was
400considered via `N`, but is TREESAME. Root commits are compared to an
401empty tree, so `I` is !TREESAME.
402+
403Parent/child relations are only visible with --parents, but that does
404not affect the commits selected in default mode, so we have shown the
405parent lines.
406
407--full-history without parent rewriting::
408
409This mode differs from the default in one point: always follow
410all parents of a merge, even if it is TREESAME to one of them.
411Even if more than one side of the merge has commits that are
412included, this does not imply that the merge itself is! In
413the example, we get
414+
415-----------------------------------------------------------------------
Junio C Hamano27159f82013-06-14 17:19:22416I A B N D O P Q
Junio C Hamanoa76cb0d2008-08-13 20:04:10417-----------------------------------------------------------------------
418+
Junio C Hamano27159f82013-06-14 17:19:22419`M` was excluded because it is TREESAME to both parents. `E`,
Junio C Hamanoa76cb0d2008-08-13 20:04:10420`C` and `B` were all walked, but only `B` was !TREESAME, so the others
421do not appear.
422+
423Note that without parent rewriting, it is not really possible to talk
424about the parent/child relationships between the commits, so we show
425them disconnected.
426
427--full-history with parent rewriting::
428
429Ordinary commits are only included if they are !TREESAME
430(though this can be changed, see '\--sparse' below).
431+
432Merges are always included. However, their parent list is rewritten:
433Along each parent, prune away commits that are not included
434themselves. This results in
435+
436-----------------------------------------------------------------------
Junio C Hamano27159f82013-06-14 17:19:22437 .-A---M---N---O---P---Q
Junio C Hamanoa76cb0d2008-08-13 20:04:10438 / / / / /
439I B / D /
440 \ / / / /
441 `-------------'
442-----------------------------------------------------------------------
443+
444Compare to '\--full-history' without rewriting above. Note that `E`
445was pruned away because it is TREESAME, but the parent list of P was
446rewritten to contain `E`'s parent `I`. The same happened for `C` and
Junio C Hamano27159f82013-06-14 17:19:22447`N`, and `X`, `Y` and `Q`.
Junio C Hamanoa76cb0d2008-08-13 20:04:10448
449In addition to the above settings, you can change whether TREESAME
450affects inclusion:
451
Junio C Hamanoeb415992008-06-08 22:49:47452--dense::
Junio C Hamanoa76cb0d2008-08-13 20:04:10453
454Commits that are walked are included if they are not TREESAME
455to any parent.
456
Junio C Hamanoeb415992008-06-08 22:49:47457--sparse::
Junio C Hamanob0e02952008-01-19 08:02:00458
Junio C Hamanoa76cb0d2008-08-13 20:04:10459All commits that are walked are included.
460+
461Note that without '\--full-history', this still simplifies merges: if
462one of the parents is TREESAME, we follow only that one, so the other
463sides of the merge are never walked.
Junio C Hamanob0e02952008-01-19 08:02:00464
Junio C Hamanoa2f46622008-09-03 05:20:31465--simplify-merges::
466
467First, build a history graph in the same way that
468'\--full-history' with parent rewriting does (see above).
469+
470Then simplify each commit `C` to its replacement `C'` in the final
471history according to the following rules:
472+
473--
474* Set `C'` to `C`.
475+
476* Replace each parent `P` of `C'` with its simplification `P'`. In
Junio C Hamano27159f82013-06-14 17:19:22477 the process, drop parents that are ancestors of other parents or that are
478 root commits TREESAME to an empty tree, and remove duplicates, but take care
479 to never drop all parents that we are TREESAME to.
Junio C Hamanoa2f46622008-09-03 05:20:31480+
481* If after this parent rewriting, `C'` is a root or merge commit (has
482 zero or >1 parents), a boundary commit, or !TREESAME, it remains.
483 Otherwise, it is replaced with its only parent.
484--
485+
486The effect of this is best shown by way of comparing to
487'\--full-history' with parent rewriting. The example turns into:
488+
489-----------------------------------------------------------------------
490 .-A---M---N---O
491 / / /
492I B D
493 \ / /
494 `---------'
495-----------------------------------------------------------------------
496+
Junio C Hamano27159f82013-06-14 17:19:22497Note the major differences in `N`, `P` and `Q` over '--full-history':
Junio C Hamanoa2f46622008-09-03 05:20:31498+
499--
500* `N`'s parent list had `I` removed, because it is an ancestor of the
501 other parent `M`. Still, `N` remained because it is !TREESAME.
502+
503* `P`'s parent list similarly had `I` removed. `P` was then
504 removed completely, because it had one parent and is TREESAME.
Junio C Hamano27159f82013-06-14 17:19:22505+
506* `Q`'s parent list had `Y` simplified to `X`. `X` was then removed, because it
507 was a TREESAME root. `Q` was then removed completely, because it had one
508 parent and is TREESAME.
Junio C Hamanoa2f46622008-09-03 05:20:31509--
Junio C Hamanob0e02952008-01-19 08:02:00510
Junio C Hamano89a57342010-06-22 23:22:55511Finally, there is a fifth simplification mode available:
512
513--ancestry-path::
514
515Limit the displayed commits to those directly on the ancestry
516chain between the "from" and "to" commits in the given commit
517range. I.e. only display commits that are ancestor of the "to"
518commit, and descendants of the "from" commit.
519+
520As an example use case, consider the following commit history:
521+
522-----------------------------------------------------------------------
523 D---E-------F
524 / \ \
525 B---C---G---H---I---J
526 / \
527A-------K---------------L--M
528-----------------------------------------------------------------------
529+
530A regular 'D..M' computes the set of commits that are ancestors of `M`,
531but excludes the ones that are ancestors of `D`. This is useful to see
532what happened to the history leading to `M` since `D`, in the sense
533that "what does `M` have that did not exist in `D`". The result in this
534example would be all the commits, except `A` and `B` (and `D` itself,
535of course).
536+
537When we want to find out what commits in `M` are contaminated with the
538bug introduced by `D` and need fixing, however, we might want to view
539only the subset of 'D..M' that are actually descendants of `D`, i.e.
Junio C Hamanob76a6862012-05-02 22:02:46540excluding `C` and `K`. This is exactly what the '--ancestry-path'
Junio C Hamano89a57342010-06-22 23:22:55541option does. Applied to the 'D..M' range, it results in:
542+
543-----------------------------------------------------------------------
544E-------F
545 \ \
546 G---H---I---J
547 \
548L--M
549-----------------------------------------------------------------------
550
Junio C Hamano28363492008-11-14 08:26:31551The '\--simplify-by-decoration' option allows you to view only the
552big picture of the topology of the history, by omitting commits
553that are not referenced by tags. Commits are marked as !TREESAME
554(in other words, kept after history simplification rules described
555above) if (1) they are referenced by tags, or (2) they change the
556contents of the paths given on the command line. All other
557commits are marked as TREESAME (subject to be simplified away).
558
Junio C Hamanob0e02952008-01-19 08:02:00559ifdef::git-rev-list[]
Junio C Hamanoa76cb0d2008-08-13 20:04:10560Bisection Helpers
561~~~~~~~~~~~~~~~~~
562
Junio C Hamanob0e02952008-01-19 08:02:00563--bisect::
564
565Limit output to the one commit object which is roughly halfway between
Junio C Hamano5706e0b2009-11-24 10:54:16566included and excluded commits. Note that the bad bisection ref
Junio C Hamano4fdccb22010-02-19 09:58:14567`refs/bisect/bad` is added to the included commits (if it
568exists) and the good bisection refs `refs/bisect/good-*` are
Junio C Hamano5706e0b2009-11-24 10:54:16569added to the excluded commits (if they exist). Thus, supposing there
Junio C Hamano4fdccb22010-02-19 09:58:14570are no refs in `refs/bisect/`, if
Junio C Hamanob0e02952008-01-19 08:02:00571
572-----------------------------------------------------------------------
Junio C Hamano175a1bd2008-11-10 00:08:57573$ git rev-list --bisect foo ^bar ^baz
Junio C Hamanob0e02952008-01-19 08:02:00574-----------------------------------------------------------------------
575
576outputs 'midpoint', the output of the two commands
577
578-----------------------------------------------------------------------
Junio C Hamano175a1bd2008-11-10 00:08:57579$ git rev-list foo ^midpoint
580$ git rev-list midpoint ^bar ^baz
Junio C Hamanob0e02952008-01-19 08:02:00581-----------------------------------------------------------------------
582
583would be of roughly the same length. Finding the change which
584introduces a regression is thus reduced to a binary search: repeatedly
585generate and test new 'midpoint's until the commit chain is of length
586one.
587
588--bisect-vars::
589
Junio C Hamano5706e0b2009-11-24 10:54:16590This calculates the same as `--bisect`, except that refs in
Junio C Hamano4fdccb22010-02-19 09:58:14591`refs/bisect/` are not used, and except that this outputs
Junio C Hamano5706e0b2009-11-24 10:54:16592text ready to be eval'ed by the shell. These lines will assign the
593name of the midpoint revision to the variable `bisect_rev`, and the
594expected number of commits to be tested after `bisect_rev` is tested
595to `bisect_nr`, the expected number of commits to be tested if
596`bisect_rev` turns out to be good to `bisect_good`, the expected
597number of commits to be tested if `bisect_rev` turns out to be bad to
598`bisect_bad`, and the number of commits we are bisecting right now to
599`bisect_all`.
Junio C Hamanob0e02952008-01-19 08:02:00600
601--bisect-all::
602
603This outputs all the commit objects between the included and excluded
604commits, ordered by their distance to the included and excluded
Junio C Hamano4fdccb22010-02-19 09:58:14605commits. Refs in `refs/bisect/` are not used. The farthest
Junio C Hamano5706e0b2009-11-24 10:54:16606from them is displayed first. (This is the only one displayed by
607`--bisect`.)
Junio C Hamano792c5a92009-03-08 08:45:13608+
Junio C Hamanob0e02952008-01-19 08:02:00609This is useful because it makes it easy to choose a good commit to
610test when you want to avoid to test some of them for some reason (they
611may not compile for example).
Junio C Hamano792c5a92009-03-08 08:45:13612+
Junio C Hamanob0e02952008-01-19 08:02:00613This option can be used along with `--bisect-vars`, in this case,
614after all the sorted commit objects, there will be the same text as if
615`--bisect-vars` had been used alone.
616endif::git-rev-list[]
617
Junio C Hamanob0e02952008-01-19 08:02:00618
619Commit Ordering
620~~~~~~~~~~~~~~~
621
622By default, the commits are shown in reverse chronological order.
623
Junio C Hamanob0e02952008-01-19 08:02:00624--date-order::
Junio C Hamanod0316112012-08-22 19:55:29625Show no parents before all of its children are shown, but
626otherwise show commits in the commit timestamp order.
Junio C Hamanob0e02952008-01-19 08:02:00627
Junio C Hamanoa1952302013-07-01 21:31:18628--author-date-order::
629Show no parents before all of its children are shown, but
630otherwise show commits in the author timestamp order.
631
Junio C Hamanod0316112012-08-22 19:55:29632--topo-order::
633Show no parents before all of its children are shown, and
634avoid showing commits on multiple lines of history
635intermixed.
636+
637For example, in a commit history like this:
638+
639----------------------------------------------------------------
640
641 ---1----2----4----7
642\ \
643 3----5----6----8---
644
645----------------------------------------------------------------
646+
647where the numbers denote the order of commit timestamps, `git
648rev-list` and friends with `--date-order` show the commits in the
649timestamp order: 8 7 6 5 4 3 2 1.
650+
651With `--topo-order`, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5
6523 1); some older commits are shown before newer ones in order to
653avoid showing the commits from two parallel development track mixed
654together.
Junio C Hamanob0e02952008-01-19 08:02:00655
656--reverse::
657
658Output the commits in reverse order.
659Cannot be combined with '\--walk-reflogs'.
660
661Object Traversal
662~~~~~~~~~~~~~~~~
663
Junio C Hamano076ffcc2013-02-06 05:13:21664These options are mostly targeted for packing of Git repositories.
Junio C Hamanob0e02952008-01-19 08:02:00665
666--objects::
667
668Print the object IDs of any object referenced by the listed
669commits. '--objects foo ^bar' thus means "send me
670all object IDs which I need to download if I have the commit
671object 'bar', but not 'foo'".
672
673--objects-edge::
674
675Similar to '--objects', but also print the IDs of excluded
676commits prefixed with a "-" character. This is used by
677linkgit:git-pack-objects[1] to build "thin" pack, which records
678objects in deltified form based on objects contained in these
679excluded commits to reduce network traffic.
680
681--unpacked::
682
683Only useful with '--objects'; print the object IDs that are not
684in packs.
685
Junio C Hamanoeccdd4a2012-09-10 23:28:17686--no-walk[=(sorted|unsorted)]::
Junio C Hamanob0e02952008-01-19 08:02:00687
Junio C Hamanoeccdd4a2012-09-10 23:28:17688Only show the given commits, but do not traverse their ancestors.
689This has no effect if a range is specified. If the argument
690"unsorted" is given, the commits are show in the order they were
691given on the command line. Otherwise (if "sorted" or no argument
692was given), the commits are show in reverse chronological order
693by commit time.
Junio C Hamanob0e02952008-01-19 08:02:00694
695--do-walk::
696
697Overrides a previous --no-walk.
Junio C Hamanod2c978f2011-03-20 19:42:22698
699Commit Formatting
700~~~~~~~~~~~~~~~~~
701
702ifdef::git-rev-list[]
703Using these options, linkgit:git-rev-list[1] will act similar to the
704more specialized family of commit log tools: linkgit:git-log[1],
705linkgit:git-show[1], and linkgit:git-whatchanged[1]
706endif::git-rev-list[]
707
708include::pretty-options.txt[]
709
710--relative-date::
711
712Synonym for `--date=relative`.
713
714--date=(relative|local|default|iso|rfc|short|raw)::
715
716Only takes effect for dates shown in human-readable format, such
717as when using "--pretty". `log.date` config variable sets a default
718value for log command's --date option.
719+
720`--date=relative` shows dates relative to the current time,
721e.g. "2 hours ago".
722+
723`--date=local` shows timestamps in user's local timezone.
724+
725`--date=iso` (or `--date=iso8601`) shows timestamps in ISO 8601 format.
726+
727`--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822
728format, often found in E-mail messages.
729+
730`--date=short` shows only date but not time, in `YYYY-MM-DD` format.
731+
Junio C Hamano076ffcc2013-02-06 05:13:21732`--date=raw` shows the date in the internal raw Git format `%s %z` format.
Junio C Hamanod2c978f2011-03-20 19:42:22733+
734`--date=default` shows timestamps in the original timezone
735(either committer's or author's).
736
737ifdef::git-rev-list[]
738--header::
739
740Print the contents of the commit in raw-format; each record is
741separated with a NUL character.
742endif::git-rev-list[]
743
744--parents::
745
746Print also the parents of the commit (in the form "commit parent...").
747Also enables parent rewriting, see 'History Simplification' below.
748
749--children::
750
751Print also the children of the commit (in the form "commit child...").
752Also enables parent rewriting, see 'History Simplification' below.
753
754ifdef::git-rev-list[]
755--timestamp::
756Print the raw commit timestamp.
757endif::git-rev-list[]
758
759--left-right::
760
761Mark which side of a symmetric diff a commit is reachable from.
762Commits from the left side are prefixed with `<` and those from
763the right with `>`. If combined with `--boundary`, those
764commits are prefixed with `-`.
765+
766For example, if you have this topology:
767+
768-----------------------------------------------------------------------
769 y---b---b branch B
770 / \ /
771 / .
772 / / \
773 o---x---a---a branch A
774-----------------------------------------------------------------------
775+
776you would get an output like this:
777+
778-----------------------------------------------------------------------
779$ git rev-list --left-right --boundary --pretty=oneline A...B
780
781>bbbbbbb... 3rd on b
782>bbbbbbb... 2nd on b
783<aaaaaaa... 3rd on a
784<aaaaaaa... 2nd on a
785-yyyyyyy... 1st on b
786-xxxxxxx... 1st on a
787-----------------------------------------------------------------------
788
789--graph::
790
791Draw a text-based graphical representation of the commit history
792on the left hand side of the output. This may cause extra lines
793to be printed in between commits, in order for the graph history
794to be drawn properly.
795+
796This enables parent rewriting, see 'History Simplification' below.
797+
798This implies the '--topo-order' option by default, but the
799'--date-order' option may also be specified.
800
801ifdef::git-rev-list[]
802--count::
803Print a number stating how many commits would have been
804listed, and suppress all other output. When used together
805with '--left-right', instead print the counts for left and
Junio C Hamanob77f8192011-05-05 01:30:38806right commits, separated by a tab. When used together with
807'--cherry-mark', omit patch equivalent commits from these
808counts and print the count for equivalent commits separated
809by a tab.
Junio C Hamanod2c978f2011-03-20 19:42:22810endif::git-rev-list[]
811
812
813ifndef::git-rev-list[]
814Diff Formatting
815~~~~~~~~~~~~~~~
816
817Below are listed options that control the formatting of diff output.
818Some of them are specific to linkgit:git-rev-list[1], however other diff
819options may be given. See linkgit:git-diff-files[1] for more options.
820
821-c::
822
823With this option, diff output for a merge commit
824shows the differences from each of the parents to the merge result
825simultaneously instead of showing pairwise diff between a parent
826and the result one at a time. Furthermore, it lists only files
827which were modified from all parents.
828
829--cc::
830
Junio C Hamano44dcd492012-07-24 04:35:38831This flag implies the '-c' option and further compresses the
Junio C Hamanod2c978f2011-03-20 19:42:22832patch output by omitting uninteresting hunks whose contents in
833the parents have only two variants and the merge result picks
834one of them without modification.
835
836-m::
837
838This flag makes the merge commits show the full diff like
839regular commits; for each merge parent, a separate log entry
840and diff is generated. An exception is that only diff against
841the first parent is shown when '--first-parent' option is given;
842in that case, the output represents the changes the merge
843brought _into_ the then-current branch.
844
845-r::
846
847Show recursive diffs.
848
849-t::
850
851Show the tree objects in the diff output. This implies '-r'.
Junio C Hamanod2c978f2011-03-20 19:42:22852endif::git-rev-list[]