Merge branch 'pw/single-key-interactive' into pw/add-p-single-key
[alt-git.git] / Documentation / rev-list-options.txt
blobfd4f4e26c90face314632ac6c2b81bed648abd17
1 Commit Limiting
2 ~~~~~~~~~~~~~~~
4 Besides specifying a range of commits that should be listed using the
5 special notations explained in the description, additional commit
6 limiting may be applied.
8 Using more options generally further limits the output (e.g.
9 `--since=<date1>` limits to commits newer than `<date1>`, and using it
10 with `--grep=<pattern>` further limits to commits whose log message
11 has a line that matches `<pattern>`), unless otherwise noted.
13 Note that these are applied before commit
14 ordering and formatting options, such as `--reverse`.
16 -<number>::
17 -n <number>::
18 --max-count=<number>::
19         Limit the number of commits to output.
21 --skip=<number>::
22         Skip 'number' commits before starting to show the commit output.
24 --since=<date>::
25 --after=<date>::
26         Show commits more recent than a specific date.
28 --until=<date>::
29 --before=<date>::
30         Show commits older than a specific date.
32 ifdef::git-rev-list[]
33 --max-age=<timestamp>::
34 --min-age=<timestamp>::
35         Limit the commits output to specified time range.
36 endif::git-rev-list[]
38 --author=<pattern>::
39 --committer=<pattern>::
40         Limit the commits output to ones with author/committer
41         header lines that match the specified pattern (regular
42         expression).  With more than one `--author=<pattern>`,
43         commits whose author matches any of the given patterns are
44         chosen (similarly for multiple `--committer=<pattern>`).
46 --grep-reflog=<pattern>::
47         Limit the commits output to ones with reflog entries that
48         match the specified pattern (regular expression). With
49         more than one `--grep-reflog`, commits whose reflog message
50         matches any of the given patterns are chosen.  It is an
51         error to use this option unless `--walk-reflogs` is in use.
53 --grep=<pattern>::
54         Limit the commits output to ones with log message that
55         matches the specified pattern (regular expression).  With
56         more than one `--grep=<pattern>`, commits whose message
57         matches any of the given patterns are chosen (but see
58         `--all-match`).
59 ifndef::git-rev-list[]
61 When `--notes` is in effect, the message from the notes is
62 matched as if it were part of the log message.
63 endif::git-rev-list[]
65 --all-match::
66         Limit the commits output to ones that match all given `--grep`,
67         instead of ones that match at least one.
69 --invert-grep::
70         Limit the commits output to ones with log message that do not
71         match the pattern specified with `--grep=<pattern>`.
73 -i::
74 --regexp-ignore-case::
75         Match the regular expression limiting patterns without regard to letter
76         case.
78 --basic-regexp::
79         Consider the limiting patterns to be basic regular expressions;
80         this is the default.
82 -E::
83 --extended-regexp::
84         Consider the limiting patterns to be extended regular expressions
85         instead of the default basic regular expressions.
87 -F::
88 --fixed-strings::
89         Consider the limiting patterns to be fixed strings (don't interpret
90         pattern as a regular expression).
92 -P::
93 --perl-regexp::
94         Consider the limiting patterns to be Perl-compatible regular
95         expressions.
97 Support for these types of regular expressions is an optional
98 compile-time dependency. If Git wasn't compiled with support for them
99 providing this option will cause it to die.
101 --remove-empty::
102         Stop when a given path disappears from the tree.
104 --merges::
105         Print only merge commits. This is exactly the same as `--min-parents=2`.
107 --no-merges::
108         Do not print commits with more than one parent. This is
109         exactly the same as `--max-parents=1`.
111 --min-parents=<number>::
112 --max-parents=<number>::
113 --no-min-parents::
114 --no-max-parents::
115         Show only commits which have at least (or at most) that many parent
116         commits. In particular, `--max-parents=1` is the same as `--no-merges`,
117         `--min-parents=2` is the same as `--merges`.  `--max-parents=0`
118         gives all root commits and `--min-parents=3` all octopus merges.
120 `--no-min-parents` and `--no-max-parents` reset these limits (to no limit)
121 again.  Equivalent forms are `--min-parents=0` (any commit has 0 or more
122 parents) and `--max-parents=-1` (negative numbers denote no upper limit).
124 --first-parent::
125         When finding commits to include, follow only the first
126         parent commit upon seeing a merge commit.  This option
127         can give a better overview when viewing the evolution of
128         a particular topic branch, because merges into a topic
129         branch tend to be only about adjusting to updated upstream
130         from time to time, and this option allows you to ignore
131         the individual commits brought in to your history by such
132         a merge.
133 ifdef::git-log[]
135 This option also changes default diff format for merge commits
136 to `first-parent`, see `--diff-merges=first-parent` for details.
137 endif::git-log[]
139 --exclude-first-parent-only::
140         When finding commits to exclude (with a '{caret}'), follow only
141         the first parent commit upon seeing a merge commit.
142         This can be used to find the set of changes in a topic branch
143         from the point where it diverged from the remote branch, given
144         that arbitrary merges can be valid topic branch changes.
146 --not::
147         Reverses the meaning of the '{caret}' prefix (or lack thereof)
148         for all following revision specifiers, up to the next `--not`.
150 --all::
151         Pretend as if all the refs in `refs/`, along with `HEAD`, are
152         listed on the command line as '<commit>'.
154 --branches[=<pattern>]::
155         Pretend as if all the refs in `refs/heads` are listed
156         on the command line as '<commit>'. If '<pattern>' is given, limit
157         branches to ones matching given shell glob. If pattern lacks '?',
158         '{asterisk}', or '[', '/{asterisk}' at the end is implied.
160 --tags[=<pattern>]::
161         Pretend as if all the refs in `refs/tags` are listed
162         on the command line as '<commit>'. If '<pattern>' is given, limit
163         tags to ones matching given shell glob. If pattern lacks '?', '{asterisk}',
164         or '[', '/{asterisk}' at the end is implied.
166 --remotes[=<pattern>]::
167         Pretend as if all the refs in `refs/remotes` are listed
168         on the command line as '<commit>'. If '<pattern>' is given, limit
169         remote-tracking branches to ones matching given shell glob.
170         If pattern lacks '?', '{asterisk}', or '[', '/{asterisk}' at the end is implied.
172 --glob=<glob-pattern>::
173         Pretend as if all the refs matching shell glob '<glob-pattern>'
174         are listed on the command line as '<commit>'. Leading 'refs/',
175         is automatically prepended if missing. If pattern lacks '?', '{asterisk}',
176         or '[', '/{asterisk}' at the end is implied.
178 --exclude=<glob-pattern>::
180         Do not include refs matching '<glob-pattern>' that the next `--all`,
181         `--branches`, `--tags`, `--remotes`, or `--glob` would otherwise
182         consider. Repetitions of this option accumulate exclusion patterns
183         up to the next `--all`, `--branches`, `--tags`, `--remotes`, or
184         `--glob` option (other options or arguments do not clear
185         accumulated patterns).
187 The patterns given should not begin with `refs/heads`, `refs/tags`, or
188 `refs/remotes` when applied to `--branches`, `--tags`, or `--remotes`,
189 respectively, and they must begin with `refs/` when applied to `--glob`
190 or `--all`. If a trailing '/{asterisk}' is intended, it must be given
191 explicitly.
193 --reflog::
194         Pretend as if all objects mentioned by reflogs are listed on the
195         command line as `<commit>`.
197 --alternate-refs::
198         Pretend as if all objects mentioned as ref tips of alternate
199         repositories were listed on the command line. An alternate
200         repository is any repository whose object directory is specified
201         in `objects/info/alternates`.  The set of included objects may
202         be modified by `core.alternateRefsCommand`, etc. See
203         linkgit:git-config[1].
205 --single-worktree::
206         By default, all working trees will be examined by the
207         following options when there are more than one (see
208         linkgit:git-worktree[1]): `--all`, `--reflog` and
209         `--indexed-objects`.
210         This option forces them to examine the current working tree
211         only.
213 --ignore-missing::
214         Upon seeing an invalid object name in the input, pretend as if
215         the bad input was not given.
217 ifndef::git-rev-list[]
218 --bisect::
219         Pretend as if the bad bisection ref `refs/bisect/bad`
220         was listed and as if it was followed by `--not` and the good
221         bisection refs `refs/bisect/good-*` on the command
222         line.
223 endif::git-rev-list[]
225 --stdin::
226         In addition to the '<commit>' listed on the command
227         line, read them from the standard input. If a `--` separator is
228         seen, stop reading commits and start reading paths to limit the
229         result.
231 ifdef::git-rev-list[]
232 --quiet::
233         Don't print anything to standard output.  This form
234         is primarily meant to allow the caller to
235         test the exit status to see if a range of objects is fully
236         connected (or not).  It is faster than redirecting stdout
237         to `/dev/null` as the output does not have to be formatted.
239 --disk-usage::
240         Suppress normal output; instead, print the sum of the bytes used
241         for on-disk storage by the selected commits or objects. This is
242         equivalent to piping the output into `git cat-file
243         --batch-check='%(objectsize:disk)'`, except that it runs much
244         faster (especially with `--use-bitmap-index`). See the `CAVEATS`
245         section in linkgit:git-cat-file[1] for the limitations of what
246         "on-disk storage" means.
247 endif::git-rev-list[]
249 --cherry-mark::
250         Like `--cherry-pick` (see below) but mark equivalent commits
251         with `=` rather than omitting them, and inequivalent ones with `+`.
253 --cherry-pick::
254         Omit any commit that introduces the same change as
255         another commit on the ``other side'' when the set of
256         commits are limited with symmetric difference.
258 For example, if you have two branches, `A` and `B`, a usual way
259 to list all commits on only one side of them is with
260 `--left-right` (see the example below in the description of
261 the `--left-right` option). However, it shows the commits that were
262 cherry-picked from the other branch (for example, ``3rd on b'' may be
263 cherry-picked from branch A). With this option, such pairs of commits are
264 excluded from the output.
266 --left-only::
267 --right-only::
268         List only commits on the respective side of a symmetric difference,
269         i.e. only those which would be marked `<` resp. `>` by
270         `--left-right`.
272 For example, `--cherry-pick --right-only A...B` omits those
273 commits from `B` which are in `A` or are patch-equivalent to a commit in
274 `A`. In other words, this lists the `+` commits from `git cherry A B`.
275 More precisely, `--cherry-pick --right-only --no-merges` gives the exact
276 list.
278 --cherry::
279         A synonym for `--right-only --cherry-mark --no-merges`; useful to
280         limit the output to the commits on our side and mark those that
281         have been applied to the other side of a forked history with
282         `git log --cherry upstream...mybranch`, similar to
283         `git cherry upstream mybranch`.
285 -g::
286 --walk-reflogs::
287         Instead of walking the commit ancestry chain, walk
288         reflog entries from the most recent one to older ones.
289         When this option is used you cannot specify commits to
290         exclude (that is, '{caret}commit', 'commit1..commit2',
291         and 'commit1\...commit2' notations cannot be used).
293 With `--pretty` format other than `oneline` and `reference` (for obvious reasons),
294 this causes the output to have two extra lines of information
295 taken from the reflog.  The reflog designator in the output may be shown
296 as `ref@{Nth}` (where `Nth` is the reverse-chronological index in the
297 reflog) or as `ref@{timestamp}` (with the timestamp for that entry),
298 depending on a few rules:
301 1. If the starting point is specified as `ref@{Nth}`, show the index
302    format.
304 2. If the starting point was specified as `ref@{now}`, show the
305    timestamp format.
307 3. If neither was used, but `--date` was given on the command line, show
308    the timestamp in the format requested by `--date`.
310 4. Otherwise, show the index format.
313 Under `--pretty=oneline`, the commit message is
314 prefixed with this information on the same line.
315 This option cannot be combined with `--reverse`.
316 See also linkgit:git-reflog[1].
318 Under `--pretty=reference`, this information will not be shown at all.
320 --merge::
321         After a failed merge, show refs that touch files having a
322         conflict and don't exist on all heads to merge.
324 --boundary::
325         Output excluded boundary commits. Boundary commits are
326         prefixed with `-`.
328 ifdef::git-rev-list[]
329 --use-bitmap-index::
331         Try to speed up the traversal using the pack bitmap index (if
332         one is available). Note that when traversing with `--objects`,
333         trees and blobs will not have their associated path printed.
335 --progress=<header>::
336         Show progress reports on stderr as objects are considered. The
337         `<header>` text will be printed with each progress update.
338 endif::git-rev-list[]
340 History Simplification
341 ~~~~~~~~~~~~~~~~~~~~~~
343 Sometimes you are only interested in parts of the history, for example the
344 commits modifying a particular <path>. But there are two parts of
345 'History Simplification', one part is selecting the commits and the other
346 is how to do it, as there are various strategies to simplify the history.
348 The following options select the commits to be shown:
350 <paths>::
351         Commits modifying the given <paths> are selected.
353 --simplify-by-decoration::
354         Commits that are referred by some branch or tag are selected.
356 Note that extra commits can be shown to give a meaningful history.
358 The following options affect the way the simplification is performed:
360 Default mode::
361         Simplifies the history to the simplest history explaining the
362         final state of the tree. Simplest because it prunes some side
363         branches if the end result is the same (i.e. merging branches
364         with the same content)
366 --show-pulls::
367         Include all commits from the default mode, but also any merge
368         commits that are not TREESAME to the first parent but are
369         TREESAME to a later parent. This mode is helpful for showing
370         the merge commits that "first introduced" a change to a branch.
372 --full-history::
373         Same as the default mode, but does not prune some history.
375 --dense::
376         Only the selected commits are shown, plus some to have a
377         meaningful history.
379 --sparse::
380         All commits in the simplified history are shown.
382 --simplify-merges::
383         Additional option to `--full-history` to remove some needless
384         merges from the resulting history, as there are no selected
385         commits contributing to this merge.
387 --ancestry-path::
388         When given a range of commits to display (e.g. 'commit1..commit2'
389         or 'commit2 {caret}commit1'), only display commits that exist
390         directly on the ancestry chain between the 'commit1' and
391         'commit2', i.e. commits that are both descendants of 'commit1',
392         and ancestors of 'commit2'.
394 A more detailed explanation follows.
396 Suppose you specified `foo` as the <paths>.  We shall call commits
397 that modify `foo` !TREESAME, and the rest TREESAME.  (In a diff
398 filtered for `foo`, they look different and equal, respectively.)
400 In the following, we will always refer to the same example history to
401 illustrate the differences between simplification settings.  We assume
402 that you are filtering for a file `foo` in this commit graph:
403 -----------------------------------------------------------------------
404           .-A---M---N---O---P---Q
405          /     /   /   /   /   /
406         I     B   C   D   E   Y
407          \   /   /   /   /   /
408           `-------------'   X
409 -----------------------------------------------------------------------
410 The horizontal line of history A---Q is taken to be the first parent of
411 each merge.  The commits are:
413 * `I` is the initial commit, in which `foo` exists with contents
414   ``asdf'', and a file `quux` exists with contents ``quux''. Initial
415   commits are compared to an empty tree, so `I` is !TREESAME.
417 * In `A`, `foo` contains just ``foo''.
419 * `B` contains the same change as `A`.  Its merge `M` is trivial and
420   hence TREESAME to all parents.
422 * `C` does not change `foo`, but its merge `N` changes it to ``foobar'',
423   so it is not TREESAME to any parent.
425 * `D` sets `foo` to ``baz''. Its merge `O` combines the strings from
426   `N` and `D` to ``foobarbaz''; i.e., it is not TREESAME to any parent.
428 * `E` changes `quux` to ``xyzzy'', and its merge `P` combines the
429   strings to ``quux xyzzy''. `P` is TREESAME to `O`, but not to `E`.
431 * `X` is an independent root commit that added a new file `side`, and `Y`
432   modified it. `Y` is TREESAME to `X`. Its merge `Q` added `side` to `P`, and
433   `Q` is TREESAME to `P`, but not to `Y`.
435 `rev-list` walks backwards through history, including or excluding
436 commits based on whether `--full-history` and/or parent rewriting
437 (via `--parents` or `--children`) are used. The following settings
438 are available.
440 Default mode::
441         Commits are included if they are not TREESAME to any parent
442         (though this can be changed, see `--sparse` below).  If the
443         commit was a merge, and it was TREESAME to one parent, follow
444         only that parent.  (Even if there are several TREESAME
445         parents, follow only one of them.)  Otherwise, follow all
446         parents.
448 This results in:
450 -----------------------------------------------------------------------
451           .-A---N---O
452          /     /   /
453         I---------D
454 -----------------------------------------------------------------------
456 Note how the rule to only follow the TREESAME parent, if one is
457 available, removed `B` from consideration entirely.  `C` was
458 considered via `N`, but is TREESAME.  Root commits are compared to an
459 empty tree, so `I` is !TREESAME.
461 Parent/child relations are only visible with `--parents`, but that does
462 not affect the commits selected in default mode, so we have shown the
463 parent lines.
465 --full-history without parent rewriting::
466         This mode differs from the default in one point: always follow
467         all parents of a merge, even if it is TREESAME to one of them.
468         Even if more than one side of the merge has commits that are
469         included, this does not imply that the merge itself is!  In
470         the example, we get
472 -----------------------------------------------------------------------
473         I  A  B  N  D  O  P  Q
474 -----------------------------------------------------------------------
476 `M` was excluded because it is TREESAME to both parents.  `E`,
477 `C` and `B` were all walked, but only `B` was !TREESAME, so the others
478 do not appear.
480 Note that without parent rewriting, it is not really possible to talk
481 about the parent/child relationships between the commits, so we show
482 them disconnected.
484 --full-history with parent rewriting::
485         Ordinary commits are only included if they are !TREESAME
486         (though this can be changed, see `--sparse` below).
488 Merges are always included.  However, their parent list is rewritten:
489 Along each parent, prune away commits that are not included
490 themselves.  This results in
492 -----------------------------------------------------------------------
493           .-A---M---N---O---P---Q
494          /     /   /   /   /
495         I     B   /   D   /
496          \   /   /   /   /
497           `-------------'
498 -----------------------------------------------------------------------
500 Compare to `--full-history` without rewriting above.  Note that `E`
501 was pruned away because it is TREESAME, but the parent list of P was
502 rewritten to contain `E`'s parent `I`.  The same happened for `C` and
503 `N`, and `X`, `Y` and `Q`.
505 In addition to the above settings, you can change whether TREESAME
506 affects inclusion:
508 --dense::
509         Commits that are walked are included if they are not TREESAME
510         to any parent.
512 --sparse::
513         All commits that are walked are included.
515 Note that without `--full-history`, this still simplifies merges: if
516 one of the parents is TREESAME, we follow only that one, so the other
517 sides of the merge are never walked.
519 --simplify-merges::
520         First, build a history graph in the same way that
521         `--full-history` with parent rewriting does (see above).
523 Then simplify each commit `C` to its replacement `C'` in the final
524 history according to the following rules:
527 * Set `C'` to `C`.
529 * Replace each parent `P` of `C'` with its simplification `P'`.  In
530   the process, drop parents that are ancestors of other parents or that are
531   root commits TREESAME to an empty tree, and remove duplicates, but take care
532   to never drop all parents that we are TREESAME to.
534 * If after this parent rewriting, `C'` is a root or merge commit (has
535   zero or >1 parents), a boundary commit, or !TREESAME, it remains.
536   Otherwise, it is replaced with its only parent.
539 The effect of this is best shown by way of comparing to
540 `--full-history` with parent rewriting.  The example turns into:
542 -----------------------------------------------------------------------
543           .-A---M---N---O
544          /     /       /
545         I     B       D
546          \   /       /
547           `---------'
548 -----------------------------------------------------------------------
550 Note the major differences in `N`, `P`, and `Q` over `--full-history`:
553 * `N`'s parent list had `I` removed, because it is an ancestor of the
554   other parent `M`.  Still, `N` remained because it is !TREESAME.
556 * `P`'s parent list similarly had `I` removed.  `P` was then
557   removed completely, because it had one parent and is TREESAME.
559 * `Q`'s parent list had `Y` simplified to `X`. `X` was then removed, because it
560   was a TREESAME root. `Q` was then removed completely, because it had one
561   parent and is TREESAME.
564 There is another simplification mode available:
566 --ancestry-path::
567         Limit the displayed commits to those directly on the ancestry
568         chain between the ``from'' and ``to'' commits in the given commit
569         range. I.e. only display commits that are ancestor of the ``to''
570         commit and descendants of the ``from'' commit.
572 As an example use case, consider the following commit history:
574 -----------------------------------------------------------------------
575             D---E-------F
576            /     \       \
577           B---C---G---H---I---J
578          /                     \
579         A-------K---------------L--M
580 -----------------------------------------------------------------------
582 A regular 'D..M' computes the set of commits that are ancestors of `M`,
583 but excludes the ones that are ancestors of `D`. This is useful to see
584 what happened to the history leading to `M` since `D`, in the sense
585 that ``what does `M` have that did not exist in `D`''. The result in this
586 example would be all the commits, except `A` and `B` (and `D` itself,
587 of course).
589 When we want to find out what commits in `M` are contaminated with the
590 bug introduced by `D` and need fixing, however, we might want to view
591 only the subset of 'D..M' that are actually descendants of `D`, i.e.
592 excluding `C` and `K`. This is exactly what the `--ancestry-path`
593 option does. Applied to the 'D..M' range, it results in:
595 -----------------------------------------------------------------------
596                 E-------F
597                  \       \
598                   G---H---I---J
599                                \
600                                 L--M
601 -----------------------------------------------------------------------
603 Before discussing another option, `--show-pulls`, we need to
604 create a new example history.
606 A common problem users face when looking at simplified history is that a
607 commit they know changed a file somehow does not appear in the file's
608 simplified history. Let's demonstrate a new example and show how options
609 such as `--full-history` and `--simplify-merges` works in that case:
611 -----------------------------------------------------------------------
612           .-A---M-----C--N---O---P
613          /     / \  \  \/   /   /
614         I     B   \  R-'`-Z'   /
615          \   /     \/         /
616           \ /      /\        /
617            `---X--'  `---Y--'
618 -----------------------------------------------------------------------
620 For this example, suppose `I` created `file.txt` which was modified by
621 `A`, `B`, and `X` in different ways. The single-parent commits `C`, `Z`,
622 and `Y` do not change `file.txt`. The merge commit `M` was created by
623 resolving the merge conflict to include both changes from `A` and `B`
624 and hence is not TREESAME to either. The merge commit `R`, however, was
625 created by ignoring the contents of `file.txt` at `M` and taking only
626 the contents of `file.txt` at `X`. Hence, `R` is TREESAME to `X` but not
627 `M`. Finally, the natural merge resolution to create `N` is to take the
628 contents of `file.txt` at `R`, so `N` is TREESAME to `R` but not `C`.
629 The merge commits `O` and `P` are TREESAME to their first parents, but
630 not to their second parents, `Z` and `Y` respectively.
632 When using the default mode, `N` and `R` both have a TREESAME parent, so
633 those edges are walked and the others are ignored. The resulting history
634 graph is:
636 -----------------------------------------------------------------------
637         I---X
638 -----------------------------------------------------------------------
640 When using `--full-history`, Git walks every edge. This will discover
641 the commits `A` and `B` and the merge `M`, but also will reveal the
642 merge commits `O` and `P`. With parent rewriting, the resulting graph is:
644 -----------------------------------------------------------------------
645           .-A---M--------N---O---P
646          /     / \  \  \/   /   /
647         I     B   \  R-'`--'   /
648          \   /     \/         /
649           \ /      /\        /
650            `---X--'  `------'
651 -----------------------------------------------------------------------
653 Here, the merge commits `O` and `P` contribute extra noise, as they did
654 not actually contribute a change to `file.txt`. They only merged a topic
655 that was based on an older version of `file.txt`. This is a common
656 issue in repositories using a workflow where many contributors work in
657 parallel and merge their topic branches along a single trunk: manu
658 unrelated merges appear in the `--full-history` results.
660 When using the `--simplify-merges` option, the commits `O` and `P`
661 disappear from the results. This is because the rewritten second parents
662 of `O` and `P` are reachable from their first parents. Those edges are
663 removed and then the commits look like single-parent commits that are
664 TREESAME to their parent. This also happens to the commit `N`, resulting
665 in a history view as follows:
667 -----------------------------------------------------------------------
668           .-A---M--.
669          /     /    \
670         I     B      R
671          \   /      /
672           \ /      /
673            `---X--'
674 -----------------------------------------------------------------------
676 In this view, we see all of the important single-parent changes from
677 `A`, `B`, and `X`. We also see the carefully-resolved merge `M` and the
678 not-so-carefully-resolved merge `R`. This is usually enough information
679 to determine why the commits `A` and `B` "disappeared" from history in
680 the default view. However, there are a few issues with this approach.
682 The first issue is performance. Unlike any previous option, the
683 `--simplify-merges` option requires walking the entire commit history
684 before returning a single result. This can make the option difficult to
685 use for very large repositories.
687 The second issue is one of auditing. When many contributors are working
688 on the same repository, it is important which merge commits introduced
689 a change into an important branch. The problematic merge `R` above is
690 not likely to be the merge commit that was used to merge into an
691 important branch. Instead, the merge `N` was used to merge `R` and `X`
692 into the important branch. This commit may have information about why
693 the change `X` came to override the changes from `A` and `B` in its
694 commit message.
696 --show-pulls::
697         In addition to the commits shown in the default history, show
698         each merge commit that is not TREESAME to its first parent but
699         is TREESAME to a later parent.
701 When a merge commit is included by `--show-pulls`, the merge is
702 treated as if it "pulled" the change from another branch. When using
703 `--show-pulls` on this example (and no other options) the resulting
704 graph is:
706 -----------------------------------------------------------------------
707         I---X---R---N
708 -----------------------------------------------------------------------
710 Here, the merge commits `R` and `N` are included because they pulled
711 the commits `X` and `R` into the base branch, respectively. These
712 merges are the reason the commits `A` and `B` do not appear in the
713 default history.
715 When `--show-pulls` is paired with `--simplify-merges`, the
716 graph includes all of the necessary information:
718 -----------------------------------------------------------------------
719           .-A---M--.   N
720          /     /    \ /
721         I     B      R
722          \   /      /
723           \ /      /
724            `---X--'
725 -----------------------------------------------------------------------
727 Notice that since `M` is reachable from `R`, the edge from `N` to `M`
728 was simplified away. However, `N` still appears in the history as an
729 important commit because it "pulled" the change `R` into the main
730 branch.
732 The `--simplify-by-decoration` option allows you to view only the
733 big picture of the topology of the history, by omitting commits
734 that are not referenced by tags.  Commits are marked as !TREESAME
735 (in other words, kept after history simplification rules described
736 above) if (1) they are referenced by tags, or (2) they change the
737 contents of the paths given on the command line.  All other
738 commits are marked as TREESAME (subject to be simplified away).
740 ifndef::git-shortlog[]
741 ifdef::git-rev-list[]
742 Bisection Helpers
743 ~~~~~~~~~~~~~~~~~
745 --bisect::
746         Limit output to the one commit object which is roughly halfway between
747         included and excluded commits. Note that the bad bisection ref
748         `refs/bisect/bad` is added to the included commits (if it
749         exists) and the good bisection refs `refs/bisect/good-*` are
750         added to the excluded commits (if they exist). Thus, supposing there
751         are no refs in `refs/bisect/`, if
753 -----------------------------------------------------------------------
754         $ git rev-list --bisect foo ^bar ^baz
755 -----------------------------------------------------------------------
757 outputs 'midpoint', the output of the two commands
759 -----------------------------------------------------------------------
760         $ git rev-list foo ^midpoint
761         $ git rev-list midpoint ^bar ^baz
762 -----------------------------------------------------------------------
764 would be of roughly the same length.  Finding the change which
765 introduces a regression is thus reduced to a binary search: repeatedly
766 generate and test new 'midpoint's until the commit chain is of length
767 one.
769 --bisect-vars::
770         This calculates the same as `--bisect`, except that refs in
771         `refs/bisect/` are not used, and except that this outputs
772         text ready to be eval'ed by the shell. These lines will assign the
773         name of the midpoint revision to the variable `bisect_rev`, and the
774         expected number of commits to be tested after `bisect_rev` is tested
775         to `bisect_nr`, the expected number of commits to be tested if
776         `bisect_rev` turns out to be good to `bisect_good`, the expected
777         number of commits to be tested if `bisect_rev` turns out to be bad to
778         `bisect_bad`, and the number of commits we are bisecting right now to
779         `bisect_all`.
781 --bisect-all::
782         This outputs all the commit objects between the included and excluded
783         commits, ordered by their distance to the included and excluded
784         commits. Refs in `refs/bisect/` are not used. The farthest
785         from them is displayed first. (This is the only one displayed by
786         `--bisect`.)
788 This is useful because it makes it easy to choose a good commit to
789 test when you want to avoid to test some of them for some reason (they
790 may not compile for example).
792 This option can be used along with `--bisect-vars`, in this case,
793 after all the sorted commit objects, there will be the same text as if
794 `--bisect-vars` had been used alone.
795 endif::git-rev-list[]
796 endif::git-shortlog[]
798 ifndef::git-shortlog[]
799 Commit Ordering
800 ~~~~~~~~~~~~~~~
802 By default, the commits are shown in reverse chronological order.
804 --date-order::
805         Show no parents before all of its children are shown, but
806         otherwise show commits in the commit timestamp order.
808 --author-date-order::
809         Show no parents before all of its children are shown, but
810         otherwise show commits in the author timestamp order.
812 --topo-order::
813         Show no parents before all of its children are shown, and
814         avoid showing commits on multiple lines of history
815         intermixed.
817 For example, in a commit history like this:
819 ----------------------------------------------------------------
821     ---1----2----4----7
822         \              \
823          3----5----6----8---
825 ----------------------------------------------------------------
827 where the numbers denote the order of commit timestamps, `git
828 rev-list` and friends with `--date-order` show the commits in the
829 timestamp order: 8 7 6 5 4 3 2 1.
831 With `--topo-order`, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5
832 3 1); some older commits are shown before newer ones in order to
833 avoid showing the commits from two parallel development track mixed
834 together.
836 --reverse::
837         Output the commits chosen to be shown (see Commit Limiting
838         section above) in reverse order. Cannot be combined with
839         `--walk-reflogs`.
840 endif::git-shortlog[]
842 ifndef::git-shortlog[]
843 Object Traversal
844 ~~~~~~~~~~~~~~~~
846 These options are mostly targeted for packing of Git repositories.
848 ifdef::git-rev-list[]
849 --objects::
850         Print the object IDs of any object referenced by the listed
851         commits.  `--objects foo ^bar` thus means ``send me
852         all object IDs which I need to download if I have the commit
853         object _bar_ but not _foo_''.
855 --in-commit-order::
856         Print tree and blob ids in order of the commits. The tree
857         and blob ids are printed after they are first referenced
858         by a commit.
860 --objects-edge::
861         Similar to `--objects`, but also print the IDs of excluded
862         commits prefixed with a ``-'' character.  This is used by
863         linkgit:git-pack-objects[1] to build a ``thin'' pack, which records
864         objects in deltified form based on objects contained in these
865         excluded commits to reduce network traffic.
867 --objects-edge-aggressive::
868         Similar to `--objects-edge`, but it tries harder to find excluded
869         commits at the cost of increased time.  This is used instead of
870         `--objects-edge` to build ``thin'' packs for shallow repositories.
872 --indexed-objects::
873         Pretend as if all trees and blobs used by the index are listed
874         on the command line.  Note that you probably want to use
875         `--objects`, too.
877 --unpacked::
878         Only useful with `--objects`; print the object IDs that are not
879         in packs.
881 --object-names::
882         Only useful with `--objects`; print the names of the object IDs
883         that are found. This is the default behavior.
885 --no-object-names::
886         Only useful with `--objects`; does not print the names of the object
887         IDs that are found. This inverts `--object-names`. This flag allows
888         the output to be more easily parsed by commands such as
889         linkgit:git-cat-file[1].
891 --filter=<filter-spec>::
892         Only useful with one of the `--objects*`; omits objects (usually
893         blobs) from the list of printed objects.  The '<filter-spec>'
894         may be one of the following:
896 The form '--filter=blob:none' omits all blobs.
898 The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes
899 or units.  n may be zero.  The suffixes k, m, and g can be used to name
900 units in KiB, MiB, or GiB.  For example, 'blob:limit=1k' is the same
901 as 'blob:limit=1024'.
903 The form '--filter=object:type=(tag|commit|tree|blob)' omits all objects
904 which are not of the requested type.
906 The form '--filter=sparse:oid=<blob-ish>' uses a sparse-checkout
907 specification contained in the blob (or blob-expression) '<blob-ish>'
908 to omit blobs that would not be required for a sparse checkout on
909 the requested refs.
911 The form '--filter=tree:<depth>' omits all blobs and trees whose depth
912 from the root tree is >= <depth> (minimum depth if an object is located
913 at multiple depths in the commits traversed). <depth>=0 will not include
914 any trees or blobs unless included explicitly in the command-line (or
915 standard input when --stdin is used). <depth>=1 will include only the
916 tree and blobs which are referenced directly by a commit reachable from
917 <commit> or an explicitly-given object. <depth>=2 is like <depth>=1
918 while also including trees and blobs one more level removed from an
919 explicitly-given commit or tree.
921 Note that the form '--filter=sparse:path=<path>' that wants to read
922 from an arbitrary path on the filesystem has been dropped for security
923 reasons.
925 Multiple '--filter=' flags can be specified to combine filters. Only
926 objects which are accepted by every filter are included.
928 The form '--filter=combine:<filter1>+<filter2>+...<filterN>' can also be
929 used to combined several filters, but this is harder than just repeating
930 the '--filter' flag and is usually not necessary. Filters are joined by
931 '{plus}' and individual filters are %-encoded (i.e. URL-encoded).
932 Besides the '{plus}' and '%' characters, the following characters are
933 reserved and also must be encoded: `~!@#$^&*()[]{}\;",<>?`+&#39;&#96;+
934 as well as all characters with ASCII code &lt;= `0x20`, which includes
935 space and newline.
937 Other arbitrary characters can also be encoded. For instance,
938 'combine:tree:3+blob:none' and 'combine:tree%3A3+blob%3Anone' are
939 equivalent.
941 --no-filter::
942         Turn off any previous `--filter=` argument.
944 --filter-provided-objects::
945         Filter the list of explicitly provided objects, which would otherwise
946         always be printed even if they did not match any of the filters. Only
947         useful with `--filter=`.
949 --filter-print-omitted::
950         Only useful with `--filter=`; prints a list of the objects omitted
951         by the filter.  Object IDs are prefixed with a ``~'' character.
953 --missing=<missing-action>::
954         A debug option to help with future "partial clone" development.
955         This option specifies how missing objects are handled.
957 The form '--missing=error' requests that rev-list stop with an error if
958 a missing object is encountered.  This is the default action.
960 The form '--missing=allow-any' will allow object traversal to continue
961 if a missing object is encountered.  Missing objects will silently be
962 omitted from the results.
964 The form '--missing=allow-promisor' is like 'allow-any', but will only
965 allow object traversal to continue for EXPECTED promisor missing objects.
966 Unexpected missing objects will raise an error.
968 The form '--missing=print' is like 'allow-any', but will also print a
969 list of the missing objects.  Object IDs are prefixed with a ``?'' character.
971 --exclude-promisor-objects::
972         (For internal use only.)  Prefilter object traversal at
973         promisor boundary.  This is used with partial clone.  This is
974         stronger than `--missing=allow-promisor` because it limits the
975         traversal, rather than just silencing errors about missing
976         objects.
977 endif::git-rev-list[]
979 --no-walk[=(sorted|unsorted)]::
980         Only show the given commits, but do not traverse their ancestors.
981         This has no effect if a range is specified. If the argument
982         `unsorted` is given, the commits are shown in the order they were
983         given on the command line. Otherwise (if `sorted` or no argument
984         was given), the commits are shown in reverse chronological order
985         by commit time.
986         Cannot be combined with `--graph`.
988 --do-walk::
989         Overrides a previous `--no-walk`.
990 endif::git-shortlog[]
992 ifndef::git-shortlog[]
993 Commit Formatting
994 ~~~~~~~~~~~~~~~~~
996 ifdef::git-rev-list[]
997 Using these options, linkgit:git-rev-list[1] will act similar to the
998 more specialized family of commit log tools: linkgit:git-log[1],
999 linkgit:git-show[1], and linkgit:git-whatchanged[1]
1000 endif::git-rev-list[]
1002 include::pretty-options.txt[]
1004 --relative-date::
1005         Synonym for `--date=relative`.
1007 --date=<format>::
1008         Only takes effect for dates shown in human-readable format, such
1009         as when using `--pretty`. `log.date` config variable sets a default
1010         value for the log command's `--date` option. By default, dates
1011         are shown in the original time zone (either committer's or
1012         author's). If `-local` is appended to the format (e.g.,
1013         `iso-local`), the user's local time zone is used instead.
1016 `--date=relative` shows dates relative to the current time,
1017 e.g. ``2 hours ago''. The `-local` option has no effect for
1018 `--date=relative`.
1020 `--date=local` is an alias for `--date=default-local`.
1022 `--date=iso` (or `--date=iso8601`) shows timestamps in a ISO 8601-like format.
1023 The differences to the strict ISO 8601 format are:
1025         - a space instead of the `T` date/time delimiter
1026         - a space between time and time zone
1027         - no colon between hours and minutes of the time zone
1029 `--date=iso-strict` (or `--date=iso8601-strict`) shows timestamps in strict
1030 ISO 8601 format.
1032 `--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822
1033 format, often found in email messages.
1035 `--date=short` shows only the date, but not the time, in `YYYY-MM-DD` format.
1037 `--date=raw` shows the date as seconds since the epoch (1970-01-01
1038 00:00:00 UTC), followed by a space, and then the timezone as an offset
1039 from UTC (a `+` or `-` with four digits; the first two are hours, and
1040 the second two are minutes). I.e., as if the timestamp were formatted
1041 with `strftime("%s %z")`).
1042 Note that the `-local` option does not affect the seconds-since-epoch
1043 value (which is always measured in UTC), but does switch the accompanying
1044 timezone value.
1046 `--date=human` shows the timezone if the timezone does not match the
1047 current time-zone, and doesn't print the whole date if that matches
1048 (ie skip printing year for dates that are "this year", but also skip
1049 the whole date itself if it's in the last few days and we can just say
1050 what weekday it was).  For older dates the hour and minute is also
1051 omitted.
1053 `--date=unix` shows the date as a Unix epoch timestamp (seconds since
1054 1970).  As with `--raw`, this is always in UTC and therefore `-local`
1055 has no effect.
1057 `--date=format:...` feeds the format `...` to your system `strftime`,
1058 except for %s, %z, and %Z, which are handled internally.
1059 Use `--date=format:%c` to show the date in your system locale's
1060 preferred format.  See the `strftime` manual for a complete list of
1061 format placeholders. When using `-local`, the correct syntax is
1062 `--date=format-local:...`.
1064 `--date=default` is the default format, and is similar to
1065 `--date=rfc2822`, with a few exceptions:
1067         - there is no comma after the day-of-week
1069         - the time zone is omitted when the local time zone is used
1071 ifdef::git-rev-list[]
1072 --header::
1073         Print the contents of the commit in raw-format; each record is
1074         separated with a NUL character.
1076 --no-commit-header::
1077         Suppress the header line containing "commit" and the object ID printed before
1078         the specified format.  This has no effect on the built-in formats; only custom
1079         formats are affected.
1081 --commit-header::
1082         Overrides a previous `--no-commit-header`.
1083 endif::git-rev-list[]
1085 --parents::
1086         Print also the parents of the commit (in the form "commit parent...").
1087         Also enables parent rewriting, see 'History Simplification' above.
1089 --children::
1090         Print also the children of the commit (in the form "commit child...").
1091         Also enables parent rewriting, see 'History Simplification' above.
1093 ifdef::git-rev-list[]
1094 --timestamp::
1095         Print the raw commit timestamp.
1096 endif::git-rev-list[]
1098 --left-right::
1099         Mark which side of a symmetric difference a commit is reachable from.
1100         Commits from the left side are prefixed with `<` and those from
1101         the right with `>`.  If combined with `--boundary`, those
1102         commits are prefixed with `-`.
1104 For example, if you have this topology:
1106 -----------------------------------------------------------------------
1107              y---b---b  branch B
1108             / \ /
1109            /   .
1110           /   / \
1111          o---x---a---a  branch A
1112 -----------------------------------------------------------------------
1114 you would get an output like this:
1116 -----------------------------------------------------------------------
1117         $ git rev-list --left-right --boundary --pretty=oneline A...B
1119         >bbbbbbb... 3rd on b
1120         >bbbbbbb... 2nd on b
1121         <aaaaaaa... 3rd on a
1122         <aaaaaaa... 2nd on a
1123         -yyyyyyy... 1st on b
1124         -xxxxxxx... 1st on a
1125 -----------------------------------------------------------------------
1127 --graph::
1128         Draw a text-based graphical representation of the commit history
1129         on the left hand side of the output.  This may cause extra lines
1130         to be printed in between commits, in order for the graph history
1131         to be drawn properly.
1132         Cannot be combined with `--no-walk`.
1134 This enables parent rewriting, see 'History Simplification' above.
1136 This implies the `--topo-order` option by default, but the
1137 `--date-order` option may also be specified.
1139 --show-linear-break[=<barrier>]::
1140         When --graph is not used, all history branches are flattened
1141         which can make it hard to see that the two consecutive commits
1142         do not belong to a linear branch. This option puts a barrier
1143         in between them in that case. If `<barrier>` is specified, it
1144         is the string that will be shown instead of the default one.
1146 ifdef::git-rev-list[]
1147 --count::
1148         Print a number stating how many commits would have been
1149         listed, and suppress all other output.  When used together
1150         with `--left-right`, instead print the counts for left and
1151         right commits, separated by a tab. When used together with
1152         `--cherry-mark`, omit patch equivalent commits from these
1153         counts and print the count for equivalent commits separated
1154         by a tab.
1155 endif::git-rev-list[]
1156 endif::git-shortlog[]