Honor $(prefix) set in config.mak* when defining ETC_GIT*
[git/dscho.git] / Documentation / rev-list-options.txt
bloba9de9a74dc71e71e776cf1b7acd667d5c01582f7
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. Note that they are applied before commit
7 ordering and formatting options, such as '--reverse'.
9 --
11 -n 'number'::
12 --max-count=<number>::
14         Limit the number of commits to output.
16 --skip=<number>::
18         Skip 'number' commits before starting to show the commit output.
20 --since=<date>::
21 --after=<date>::
23         Show commits more recent than a specific date.
25 --until=<date>::
26 --before=<date>::
28         Show commits older than a specific date.
30 ifdef::git-rev-list[]
31 --max-age=<timestamp>::
32 --min-age=<timestamp>::
34         Limit the commits output to specified time range.
35 endif::git-rev-list[]
37 --author=<pattern>::
38 --committer=<pattern>::
40         Limit the commits output to ones with author/committer
41         header lines that match the specified pattern (regular expression).
43 --grep=<pattern>::
45         Limit the commits output to ones with log message that
46         matches the specified pattern (regular expression).
48 --all-match::
49         Limit the commits output to ones that match all given --grep,
50         --author and --committer instead of ones that match at least one.
52 -i::
53 --regexp-ignore-case::
55         Match the regexp limiting patterns without regard to letters case.
57 -E::
58 --extended-regexp::
60         Consider the limiting patterns to be extended regular expressions
61         instead of the default basic regular expressions.
63 -F::
64 --fixed-strings::
66         Consider the limiting patterns to be fixed strings (don't interpret
67         pattern as a regular expression).
69 --remove-empty::
71         Stop when a given path disappears from the tree.
73 --merges::
75         Print only merge commits.
77 --no-merges::
79         Do not print commits with more than one parent.
81 --first-parent::
82         Follow only the first parent commit upon seeing a merge
83         commit.  This option can give a better overview when
84         viewing the evolution of a particular topic branch,
85         because merges into a topic branch tend to be only about
86         adjusting to updated upstream from time to time, and
87         this option allows you to ignore the individual commits
88         brought in to your history by such a merge.
90 --not::
92         Reverses the meaning of the '{caret}' prefix (or lack thereof)
93         for all following revision specifiers, up to the next '--not'.
95 --all::
97         Pretend as if all the refs in `refs/` are listed on the
98         command line as '<commit>'.
100 --branches[=<pattern>]::
102         Pretend as if all the refs in `refs/heads` are listed
103         on the command line as '<commit>'. If '<pattern>' is given, limit
104         branches to ones matching given shell glob. If pattern lacks '?',
105         '*', or '[', '/*' at the end is implied.
107 --tags[=<pattern>]::
109         Pretend as if all the refs in `refs/tags` are listed
110         on the command line as '<commit>'. If '<pattern>' is given, limit
111         tags to ones matching given shell glob. If pattern lacks '?', '*',
112         or '[', '/*' at the end is implied.
114 --remotes[=<pattern>]::
116         Pretend as if all the refs in `refs/remotes` are listed
117         on the command line as '<commit>'. If '<pattern>' is given, limit
118         remote-tracking branches to ones matching given shell glob.
119         If pattern lacks '?', '*', or '[', '/*' at the end is implied.
121 --glob=<glob-pattern>::
122         Pretend as if all the refs matching shell glob '<glob-pattern>'
123         are listed on the command line as '<commit>'. Leading 'refs/',
124         is automatically prepended if missing. If pattern lacks '?', '*',
125         or '[', '/*' at the end is implied.
128 ifndef::git-rev-list[]
129 --bisect::
131         Pretend as if the bad bisection ref `refs/bisect/bad`
132         was listed and as if it was followed by `--not` and the good
133         bisection refs `refs/bisect/good-*` on the command
134         line.
135 endif::git-rev-list[]
137 --stdin::
139         In addition to the '<commit>' listed on the command
140         line, read them from the standard input. If a '--' separator is
141         seen, stop reading commits and start reading paths to limit the
142         result.
144 ifdef::git-rev-list[]
145 --quiet::
147         Don't print anything to standard output.  This form
148         is primarily meant to allow the caller to
149         test the exit status to see if a range of objects is fully
150         connected (or not).  It is faster than redirecting stdout
151         to /dev/null as the output does not have to be formatted.
152 endif::git-rev-list[]
154 --cherry-pick::
156         Omit any commit that introduces the same change as
157         another commit on the "other side" when the set of
158         commits are limited with symmetric difference.
160 For example, if you have two branches, `A` and `B`, a usual way
161 to list all commits on only one side of them is with
162 `--left-right` (see the example below in the description of
163 the `--left-right` option).  It however shows the commits that were cherry-picked
164 from the other branch (for example, "3rd on b" may be cherry-picked
165 from branch A).  With this option, such pairs of commits are
166 excluded from the output.
168 -g::
169 --walk-reflogs::
171         Instead of walking the commit ancestry chain, walk
172         reflog entries from the most recent one to older ones.
173         When this option is used you cannot specify commits to
174         exclude (that is, '{caret}commit', 'commit1..commit2',
175         nor 'commit1\...commit2' notations cannot be used).
177 With '\--pretty' format other than oneline (for obvious reasons),
178 this causes the output to have two extra lines of information
179 taken from the reflog.  By default, 'commit@\{Nth}' notation is
180 used in the output.  When the starting commit is specified as
181 'commit@\{now}', output also uses 'commit@\{timestamp}' notation
182 instead.  Under '\--pretty=oneline', the commit message is
183 prefixed with this information on the same line.
184 This option cannot be combined with '\--reverse'.
185 See also linkgit:git-reflog[1].
187 --merge::
189         After a failed merge, show refs that touch files having a
190         conflict and don't exist on all heads to merge.
192 --boundary::
194         Output uninteresting commits at the boundary, which are usually
195         not shown.
199 History Simplification
200 ~~~~~~~~~~~~~~~~~~~~~~
202 Sometimes you are only interested in parts of the history, for example the
203 commits modifying a particular <path>. But there are two parts of
204 'History Simplification', one part is selecting the commits and the other
205 is how to do it, as there are various strategies to simplify the history.
207 The following options select the commits to be shown:
209 <paths>::
211         Commits modifying the given <paths> are selected.
213 --simplify-by-decoration::
215         Commits that are referred by some branch or tag are selected.
217 Note that extra commits can be shown to give a meaningful history.
219 The following options affect the way the simplification is performed:
221 Default mode::
223         Simplifies the history to the simplest history explaining the
224         final state of the tree. Simplest because it prunes some side
225         branches if the end result is the same (i.e. merging branches
226         with the same content)
228 --full-history::
230         As the default mode but does not prune some history.
232 --dense::
234         Only the selected commits are shown, plus some to have a
235         meaningful history.
237 --sparse::
239         All commits in the simplified history are shown.
241 --simplify-merges::
243         Additional option to '--full-history' to remove some needless
244         merges from the resulting history, as there are no selected
245         commits contributing to this merge.
247 --ancestry-path::
249         When given a range of commits to display (e.g. 'commit1..commit2'
250         or 'commit2 {caret}commit1'), only display commits that exist
251         directly on the ancestry chain between the 'commit1' and
252         'commit2', i.e. commits that are both descendants of 'commit1',
253         and ancestors of 'commit2'.
255 A more detailed explanation follows.
257 Suppose you specified `foo` as the <paths>.  We shall call commits
258 that modify `foo` !TREESAME, and the rest TREESAME.  (In a diff
259 filtered for `foo`, they look different and equal, respectively.)
261 In the following, we will always refer to the same example history to
262 illustrate the differences between simplification settings.  We assume
263 that you are filtering for a file `foo` in this commit graph:
264 -----------------------------------------------------------------------
265           .-A---M---N---O---P
266          /     /   /   /   /
267         I     B   C   D   E
268          \   /   /   /   /
269           `-------------'
270 -----------------------------------------------------------------------
271 The horizontal line of history A--P is taken to be the first parent of
272 each merge.  The commits are:
274 * `I` is the initial commit, in which `foo` exists with contents
275   "asdf", and a file `quux` exists with contents "quux".  Initial
276   commits are compared to an empty tree, so `I` is !TREESAME.
278 * In `A`, `foo` contains just "foo".
280 * `B` contains the same change as `A`.  Its merge `M` is trivial and
281   hence TREESAME to all parents.
283 * `C` does not change `foo`, but its merge `N` changes it to "foobar",
284   so it is not TREESAME to any parent.
286 * `D` sets `foo` to "baz".  Its merge `O` combines the strings from
287   `N` and `D` to "foobarbaz"; i.e., it is not TREESAME to any parent.
289 * `E` changes `quux` to "xyzzy", and its merge `P` combines the
290   strings to "quux xyzzy".  Despite appearing interesting, `P` is
291   TREESAME to all parents.
293 'rev-list' walks backwards through history, including or excluding
294 commits based on whether '\--full-history' and/or parent rewriting
295 (via '\--parents' or '\--children') are used.  The following settings
296 are available.
298 Default mode::
300         Commits are included if they are not TREESAME to any parent
301         (though this can be changed, see '\--sparse' below).  If the
302         commit was a merge, and it was TREESAME to one parent, follow
303         only that parent.  (Even if there are several TREESAME
304         parents, follow only one of them.)  Otherwise, follow all
305         parents.
307 This results in:
309 -----------------------------------------------------------------------
310           .-A---N---O
311          /     /   /
312         I---------D
313 -----------------------------------------------------------------------
315 Note how the rule to only follow the TREESAME parent, if one is
316 available, removed `B` from consideration entirely.  `C` was
317 considered via `N`, but is TREESAME.  Root commits are compared to an
318 empty tree, so `I` is !TREESAME.
320 Parent/child relations are only visible with --parents, but that does
321 not affect the commits selected in default mode, so we have shown the
322 parent lines.
324 --full-history without parent rewriting::
326         This mode differs from the default in one point: always follow
327         all parents of a merge, even if it is TREESAME to one of them.
328         Even if more than one side of the merge has commits that are
329         included, this does not imply that the merge itself is!  In
330         the example, we get
332 -----------------------------------------------------------------------
333         I  A  B  N  D  O
334 -----------------------------------------------------------------------
336 `P` and `M` were excluded because they are TREESAME to a parent.  `E`,
337 `C` and `B` were all walked, but only `B` was !TREESAME, so the others
338 do not appear.
340 Note that without parent rewriting, it is not really possible to talk
341 about the parent/child relationships between the commits, so we show
342 them disconnected.
344 --full-history with parent rewriting::
346         Ordinary commits are only included if they are !TREESAME
347         (though this can be changed, see '\--sparse' below).
349 Merges are always included.  However, their parent list is rewritten:
350 Along each parent, prune away commits that are not included
351 themselves.  This results in
353 -----------------------------------------------------------------------
354           .-A---M---N---O---P
355          /     /   /   /   /
356         I     B   /   D   /
357          \   /   /   /   /
358           `-------------'
359 -----------------------------------------------------------------------
361 Compare to '\--full-history' without rewriting above.  Note that `E`
362 was pruned away because it is TREESAME, but the parent list of P was
363 rewritten to contain `E`'s parent `I`.  The same happened for `C` and
364 `N`.  Note also that `P` was included despite being TREESAME.
366 In addition to the above settings, you can change whether TREESAME
367 affects inclusion:
369 --dense::
371         Commits that are walked are included if they are not TREESAME
372         to any parent.
374 --sparse::
376         All commits that are walked are included.
378 Note that without '\--full-history', this still simplifies merges: if
379 one of the parents is TREESAME, we follow only that one, so the other
380 sides of the merge are never walked.
382 --simplify-merges::
384         First, build a history graph in the same way that
385         '\--full-history' with parent rewriting does (see above).
387 Then simplify each commit `C` to its replacement `C'` in the final
388 history according to the following rules:
391 * Set `C'` to `C`.
393 * Replace each parent `P` of `C'` with its simplification `P'`.  In
394   the process, drop parents that are ancestors of other parents, and
395   remove duplicates.
397 * If after this parent rewriting, `C'` is a root or merge commit (has
398   zero or >1 parents), a boundary commit, or !TREESAME, it remains.
399   Otherwise, it is replaced with its only parent.
402 The effect of this is best shown by way of comparing to
403 '\--full-history' with parent rewriting.  The example turns into:
405 -----------------------------------------------------------------------
406           .-A---M---N---O
407          /     /       /
408         I     B       D
409          \   /       /
410           `---------'
411 -----------------------------------------------------------------------
413 Note the major differences in `N` and `P` over '\--full-history':
416 * `N`'s parent list had `I` removed, because it is an ancestor of the
417   other parent `M`.  Still, `N` remained because it is !TREESAME.
419 * `P`'s parent list similarly had `I` removed.  `P` was then
420   removed completely, because it had one parent and is TREESAME.
423 Finally, there is a fifth simplification mode available:
425 --ancestry-path::
427         Limit the displayed commits to those directly on the ancestry
428         chain between the "from" and "to" commits in the given commit
429         range. I.e. only display commits that are ancestor of the "to"
430         commit, and descendants of the "from" commit.
432 As an example use case, consider the following commit history:
434 -----------------------------------------------------------------------
435             D---E-------F
436            /     \       \
437           B---C---G---H---I---J
438          /                     \
439         A-------K---------------L--M
440 -----------------------------------------------------------------------
442 A regular 'D..M' computes the set of commits that are ancestors of `M`,
443 but excludes the ones that are ancestors of `D`. This is useful to see
444 what happened to the history leading to `M` since `D`, in the sense
445 that "what does `M` have that did not exist in `D`". The result in this
446 example would be all the commits, except `A` and `B` (and `D` itself,
447 of course).
449 When we want to find out what commits in `M` are contaminated with the
450 bug introduced by `D` and need fixing, however, we might want to view
451 only the subset of 'D..M' that are actually descendants of `D`, i.e.
452 excluding `C` and `K`. This is exactly what the '\--ancestry-path'
453 option does. Applied to the 'D..M' range, it results in:
455 -----------------------------------------------------------------------
456                 E-------F
457                  \       \
458                   G---H---I---J
459                                \
460                                 L--M
461 -----------------------------------------------------------------------
463 The '\--simplify-by-decoration' option allows you to view only the
464 big picture of the topology of the history, by omitting commits
465 that are not referenced by tags.  Commits are marked as !TREESAME
466 (in other words, kept after history simplification rules described
467 above) if (1) they are referenced by tags, or (2) they change the
468 contents of the paths given on the command line.  All other
469 commits are marked as TREESAME (subject to be simplified away).
471 ifdef::git-rev-list[]
472 Bisection Helpers
473 ~~~~~~~~~~~~~~~~~
475 --bisect::
477 Limit output to the one commit object which is roughly halfway between
478 included and excluded commits. Note that the bad bisection ref
479 `refs/bisect/bad` is added to the included commits (if it
480 exists) and the good bisection refs `refs/bisect/good-*` are
481 added to the excluded commits (if they exist). Thus, supposing there
482 are no refs in `refs/bisect/`, if
484 -----------------------------------------------------------------------
485         $ git rev-list --bisect foo ^bar ^baz
486 -----------------------------------------------------------------------
488 outputs 'midpoint', the output of the two commands
490 -----------------------------------------------------------------------
491         $ git rev-list foo ^midpoint
492         $ git rev-list midpoint ^bar ^baz
493 -----------------------------------------------------------------------
495 would be of roughly the same length.  Finding the change which
496 introduces a regression is thus reduced to a binary search: repeatedly
497 generate and test new 'midpoint's until the commit chain is of length
498 one.
500 --bisect-vars::
502 This calculates the same as `--bisect`, except that refs in
503 `refs/bisect/` are not used, and except that this outputs
504 text ready to be eval'ed by the shell. These lines will assign the
505 name of the midpoint revision to the variable `bisect_rev`, and the
506 expected number of commits to be tested after `bisect_rev` is tested
507 to `bisect_nr`, the expected number of commits to be tested if
508 `bisect_rev` turns out to be good to `bisect_good`, the expected
509 number of commits to be tested if `bisect_rev` turns out to be bad to
510 `bisect_bad`, and the number of commits we are bisecting right now to
511 `bisect_all`.
513 --bisect-all::
515 This outputs all the commit objects between the included and excluded
516 commits, ordered by their distance to the included and excluded
517 commits. Refs in `refs/bisect/` are not used. The farthest
518 from them is displayed first. (This is the only one displayed by
519 `--bisect`.)
521 This is useful because it makes it easy to choose a good commit to
522 test when you want to avoid to test some of them for some reason (they
523 may not compile for example).
525 This option can be used along with `--bisect-vars`, in this case,
526 after all the sorted commit objects, there will be the same text as if
527 `--bisect-vars` had been used alone.
528 endif::git-rev-list[]
531 Commit Ordering
532 ~~~~~~~~~~~~~~~
534 By default, the commits are shown in reverse chronological order.
536 --topo-order::
538         This option makes them appear in topological order (i.e.
539         descendant commits are shown before their parents).
541 --date-order::
543         This option is similar to '--topo-order' in the sense that no
544         parent comes before all of its children, but otherwise things
545         are still ordered in the commit timestamp order.
547 --reverse::
549         Output the commits in reverse order.
550         Cannot be combined with '\--walk-reflogs'.
552 Object Traversal
553 ~~~~~~~~~~~~~~~~
555 These options are mostly targeted for packing of git repositories.
557 --objects::
559         Print the object IDs of any object referenced by the listed
560         commits.  '--objects foo ^bar' thus means "send me
561         all object IDs which I need to download if I have the commit
562         object 'bar', but not 'foo'".
564 --objects-edge::
566         Similar to '--objects', but also print the IDs of excluded
567         commits prefixed with a "-" character.  This is used by
568         linkgit:git-pack-objects[1] to build "thin" pack, which records
569         objects in deltified form based on objects contained in these
570         excluded commits to reduce network traffic.
572 --unpacked::
574         Only useful with '--objects'; print the object IDs that are not
575         in packs.
577 --no-walk::
579         Only show the given revs, but do not traverse their ancestors.
581 --do-walk::
583         Overrides a previous --no-walk.
585 Commit Formatting
586 ~~~~~~~~~~~~~~~~~
588 ifdef::git-rev-list[]
589 Using these options, linkgit:git-rev-list[1] will act similar to the
590 more specialized family of commit log tools: linkgit:git-log[1],
591 linkgit:git-show[1], and linkgit:git-whatchanged[1]
592 endif::git-rev-list[]
594 include::pretty-options.txt[]
596 --relative-date::
598         Synonym for `--date=relative`.
600 --date=(relative|local|default|iso|rfc|short|raw)::
602         Only takes effect for dates shown in human-readable format, such
603         as when using "--pretty". `log.date` config variable sets a default
604         value for log command's --date option.
606 `--date=relative` shows dates relative to the current time,
607 e.g. "2 hours ago".
609 `--date=local` shows timestamps in user's local timezone.
611 `--date=iso` (or `--date=iso8601`) shows timestamps in ISO 8601 format.
613 `--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822
614 format, often found in E-mail messages.
616 `--date=short` shows only date but not time, in `YYYY-MM-DD` format.
618 `--date=raw` shows the date in the internal raw git format `%s %z` format.
620 `--date=default` shows timestamps in the original timezone
621 (either committer's or author's).
623 ifdef::git-rev-list[]
624 --header::
626         Print the contents of the commit in raw-format; each record is
627         separated with a NUL character.
628 endif::git-rev-list[]
630 --parents::
632         Print also the parents of the commit (in the form "commit parent...").
633         Also enables parent rewriting, see 'History Simplification' below.
635 --children::
637         Print also the children of the commit (in the form "commit child...").
638         Also enables parent rewriting, see 'History Simplification' below.
640 ifdef::git-rev-list[]
641 --timestamp::
642         Print the raw commit timestamp.
643 endif::git-rev-list[]
645 --left-right::
647         Mark which side of a symmetric diff a commit is reachable from.
648         Commits from the left side are prefixed with `<` and those from
649         the right with `>`.  If combined with `--boundary`, those
650         commits are prefixed with `-`.
652 For example, if you have this topology:
654 -----------------------------------------------------------------------
655              y---b---b  branch B
656             / \ /
657            /   .
658           /   / \
659          o---x---a---a  branch A
660 -----------------------------------------------------------------------
662 you would get an output like this:
664 -----------------------------------------------------------------------
665         $ git rev-list --left-right --boundary --pretty=oneline A...B
667         >bbbbbbb... 3rd on b
668         >bbbbbbb... 2nd on b
669         <aaaaaaa... 3rd on a
670         <aaaaaaa... 2nd on a
671         -yyyyyyy... 1st on b
672         -xxxxxxx... 1st on a
673 -----------------------------------------------------------------------
675 --graph::
677         Draw a text-based graphical representation of the commit history
678         on the left hand side of the output.  This may cause extra lines
679         to be printed in between commits, in order for the graph history
680         to be drawn properly.
682 This enables parent rewriting, see 'History Simplification' below.
684 This implies the '--topo-order' option by default, but the
685 '--date-order' option may also be specified.
687 ifdef::git-rev-list[]
688 --count::
689         Print a number stating how many commits would have been
690         listed, and suppress all other output.  When used together
691         with '--left-right', instead print the counts for left and
692         right commits, separated by a tab.
693 endif::git-rev-list[]
696 ifndef::git-rev-list[]
697 Diff Formatting
698 ~~~~~~~~~~~~~~~
700 Below are listed options that control the formatting of diff output.
701 Some of them are specific to linkgit:git-rev-list[1], however other diff
702 options may be given. See linkgit:git-diff-files[1] for more options.
704 -c::
706         With this option, diff output for a merge commit
707         shows the differences from each of the parents to the merge result
708         simultaneously instead of showing pairwise diff between a parent
709         and the result one at a time. Furthermore, it lists only files
710         which were modified from all parents.
712 --cc::
714         This flag implies the '-c' options and further compresses the
715         patch output by omitting uninteresting hunks whose contents in
716         the parents have only two variants and the merge result picks
717         one of them without modification.
719 -m::
721         This flag makes the merge commits show the full diff like
722         regular commits; for each merge parent, a separate log entry
723         and diff is generated. An exception is that only diff against
724         the first parent is shown when '--first-parent' option is given;
725         in that case, the output represents the changes the merge
726         brought _into_ the then-current branch.
728 -r::
730         Show recursive diffs.
732 -t::
734         Show the tree objects in the diff output. This implies '-r'.
736 -s::
737         Suppress diff output.
738 endif::git-rev-list[]