1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.4.5" />
7 <title>git-rev-list(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.5em;
116 margin-bottom: 1.5em;
118 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
119 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
120 div
.admonitionblock
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
245 list-style-type: upper-roman
;
248 div
.compact ul
, div
.compact ol
,
249 div
.compact p
, div
.compact p
,
250 div
.compact div
, div
.compact div
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
275 div
.tableblock
> table
[frame
="hsides"] {
276 border-left-style: none
;
277 border-right-style: none
;
279 div
.tableblock
> table
[frame
="vsides"] {
280 border-top-style: none
;
281 border-bottom-style: none
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-rev-list(
1) Manual Page
409 <div class=
"sectionbody">
411 Lists commit objects in reverse chronological order
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"verseblock">
418 <div class=
"verseblock-content"><em>git rev-list
</em> [ --max-count=
<number
> ]
419 [ --skip=
<number
> ]
420 [ --max-age=
<timestamp
> ]
421 [ --min-age=
<timestamp
> ]
430 [ --branches[=
<pattern
>] ]
431 [ --tags[=
<pattern
>] ]
432 [ --remotes[=
<pattern
>] ]
433 [ --glob=
<glob-pattern
> ]
441 [ --encoding[=
<encoding
>] ]
442 [ --(author|committer|grep)=
<pattern
> ]
443 [ --regexp-ignore-case | -i ]
444 [ --extended-regexp | -E ]
445 [ --fixed-strings | -F ]
446 [ --date=(local|relative|default|iso|rfc|short) ]
447 [ [--objects | --objects-edge] [ --unpacked ] ]
448 [ --pretty | --header ]
455 [ --no-walk ] [ --do-walk ]
456 <commit
>… [ --
<paths
>… ]
</div>
457 <div class=
"verseblock-attribution">
460 <h2 id=
"_description">DESCRIPTION
</h2>
461 <div class=
"sectionbody">
462 <div class=
"paragraph"><p>List commits that are reachable by following the
<tt>parent
</tt> links from the
463 given commit(s), but exclude commits that are reachable from the one(s)
464 given with a
<em>^</em> in front of them. The output is given in reverse
465 chronological order by default.
</p></div>
466 <div class=
"paragraph"><p>You can think of this as a set operation. Commits given on the command
467 line form a set of commits that are reachable from any of them, and then
468 commits reachable from any of the ones given with
<em>^</em> in front are
469 subtracted from that set. The remaining commits are what comes out in the
470 command
’s output. Various other options and paths parameters can be used
471 to further limit the result.
</p></div>
472 <div class=
"paragraph"><p>Thus, the following command:
</p></div>
473 <div class=
"listingblock">
474 <div class=
"content">
475 <pre><tt> $ git rev-list foo bar ^baz
</tt></pre>
477 <div class=
"paragraph"><p>means
"list all the commits which are reachable from <em>foo</em> or <em>bar</em>, but
478 not from <em>baz</em>".
</p></div>
479 <div class=
"paragraph"><p>A special notation
"<em><commit1></em>..<em><commit2></em>" can be used as a
480 short-hand for
"^<em><commit1></em> <em><commit2></em>". For example, either of
481 the following may be used interchangeably:
</p></div>
482 <div class=
"listingblock">
483 <div class=
"content">
484 <pre><tt> $ git rev-list origin..HEAD
485 $ git rev-list HEAD ^origin
</tt></pre>
487 <div class=
"paragraph"><p>Another special notation is
"<em><commit1></em>…<em><commit2></em>" which is useful
488 for merges. The resulting set of commits is the symmetric difference
489 between the two operands. The following two commands are equivalent:
</p></div>
490 <div class=
"listingblock">
491 <div class=
"content">
492 <pre><tt> $ git rev-list A B --not $(git merge-base --all A B)
493 $ git rev-list A...B
</tt></pre>
495 <div class=
"paragraph"><p><em>rev-list
</em> is a very essential git command, since it
496 provides the ability to build and traverse commit ancestry graphs. For
497 this reason, it has a lot of different options that enables it to be
498 used by commands as different as
<em>git bisect
</em> and
499 <em>git repack
</em>.
</p></div>
501 <h2 id=
"_options">OPTIONS
</h2>
502 <div class=
"sectionbody">
503 <h3 id=
"_commit_formatting">Commit Formatting
</h3><div style=
"clear:left"></div>
504 <div class=
"paragraph"><p>Using these options,
<a href=
"git-rev-list.html">git-rev-list(
1)
</a> will act similar to the
505 more specialized family of commit log tools:
<a href=
"git-log.html">git-log(
1)
</a>,
506 <a href=
"git-show.html">git-show(
1)
</a>, and
<a href=
"git-whatchanged.html">git-whatchanged(
1)
</a></p></div>
507 <div class=
"dlist"><dl>
509 --pretty[=
<format
>]
512 --format=
<format
>
516 Pretty-print the contents of the commit logs in a given format,
517 where
<em><format
></em> can be one of
<em>oneline
</em>,
<em>short
</em>,
<em>medium
</em>,
518 <em>full
</em>,
<em>fuller
</em>,
<em>email
</em>,
<em>raw
</em> and
<em>format:
<string
></em>. See
519 the
"PRETTY FORMATS" section for some additional details for each
520 format. When omitted, the format defaults to
<em>medium
</em>.
522 <div class=
"paragraph"><p>Note: you can specify the default pretty format in the repository
523 configuration (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
530 Instead of showing the full
40-byte hexadecimal commit object
531 name, show only a partial prefix. Non default number of
532 digits can be specified with
"--abbrev=<n>" (which also modifies
533 diff output, if it is displayed).
535 <div class=
"paragraph"><p>This should make
"--pretty=oneline" a whole lot more readable for
536 people using
80-column terminals.
</p></div>
543 This is a shorthand for
"--pretty=oneline --abbrev-commit"
548 --encoding[=
<encoding
>]
552 The commit objects record the encoding used for the log message
553 in their encoding header; this option can be used to tell the
554 command to re-code the commit log message in the encoding
555 preferred by the user. For non plumbing commands this
563 --show-notes[=
<ref
>]
567 Show the notes (see
<a href=
"git-notes.html">git-notes(
1)
</a>) that annotate the
568 commit, when showing the commit log message. This is the default
569 for
<tt>git log
</tt>,
<tt>git show
</tt> and
<tt>git whatchanged
</tt> commands when
570 there is no
<tt>--pretty
</tt>,
<tt>--format
</tt> nor
<tt>--oneline
</tt> option is
571 given on the command line.
573 <div class=
"paragraph"><p>With an optional argument, add this ref to the list of notes. The ref
574 is taken to be in
<tt>refs/notes/
</tt> if it is not qualified.
</p></div>
577 --[no-]standard-notes
581 Enable or disable populating the notes ref list from the
582 <em>core.notesRef
</em> and
<em>notes.displayRef
</em> variables (or
583 corresponding environment overrides). Enabled by default.
584 See
<a href=
"git-config.html">git-config(
1)
</a>.
592 Synonym for
<tt>--date=relative
</tt>.
596 --date=(relative|local|default|iso|rfc|short|raw)
600 Only takes effect for dates shown in human-readable format, such
601 as when using
"--pretty".
<tt>log.date
</tt> config variable sets a default
602 value for log command
’s --date option.
604 <div class=
"paragraph"><p><tt>--date=relative
</tt> shows dates relative to the current time,
605 e.g.
"2 hours ago".
</p></div>
606 <div class=
"paragraph"><p><tt>--date=local
</tt> shows timestamps in user
’s local timezone.
</p></div>
607 <div class=
"paragraph"><p><tt>--date=iso
</tt> (or
<tt>--date=iso8601
</tt>) shows timestamps in ISO
8601 format.
</p></div>
608 <div class=
"paragraph"><p><tt>--date=rfc
</tt> (or
<tt>--date=rfc2822
</tt>) shows timestamps in RFC
2822
609 format, often found in E-mail messages.
</p></div>
610 <div class=
"paragraph"><p><tt>--date=short
</tt> shows only date but not time, in
<tt>YYYY-MM-DD
</tt> format.
</p></div>
611 <div class=
"paragraph"><p><tt>--date=raw
</tt> shows the date in the internal raw git format
<tt>%s %z
</tt> format.
</p></div>
612 <div class=
"paragraph"><p><tt>--date=default
</tt> shows timestamps in the original timezone
613 (either committer
’s or author
’s).
</p></div>
620 Print the contents of the commit in raw-format; each record is
621 separated with a NUL character.
629 Print also the parents of the commit (in the form
"commit parent…").
630 Also enables parent rewriting, see
<em>History Simplification
</em> below.
638 Print also the children of the commit (in the form
"commit child…").
639 Also enables parent rewriting, see
<em>History Simplification
</em> below.
647 Print the raw commit timestamp.
655 Mark which side of a symmetric diff a commit is reachable from.
656 Commits from the left side are prefixed with
<tt><</tt> and those from
657 the right with
<tt>></tt>. If combined with
<tt>--boundary
</tt>, those
658 commits are prefixed with
<tt>-
</tt>.
660 <div class=
"paragraph"><p>For example, if you have this topology:
</p></div>
661 <div class=
"listingblock">
662 <div class=
"content">
663 <pre><tt> y---b---b branch B
667 o---x---a---a branch A
</tt></pre>
669 <div class=
"paragraph"><p>you would get an output like this:
</p></div>
670 <div class=
"listingblock">
671 <div class=
"content">
672 <pre><tt> $ git rev-list --left-right --boundary --pretty=oneline A...B
674 >bbbbbbb...
3rd on b
675 >bbbbbbb...
2nd on b
676 <aaaaaaa...
3rd on a
677 <aaaaaaa...
2nd on a
679 -xxxxxxx...
1st on a
</tt></pre>
687 Draw a text-based graphical representation of the commit history
688 on the left hand side of the output. This may cause extra lines
689 to be printed in between commits, in order for the graph history
690 to be drawn properly.
692 <div class=
"paragraph"><p>This enables parent rewriting, see
<em>History Simplification
</em> below.
</p></div>
693 <div class=
"paragraph"><p>This implies the
<em>--topo-order
</em> option by default, but the
694 <em>--date-order
</em> option may also be specified.
</p></div>
701 Print a number stating how many commits would have been
702 listed, and suppress all other output. When used together
703 with
<em>--left-right
</em>, instead print the counts for left and
704 right commits, separated by a tab.
708 <h3 id=
"_commit_limiting">Commit Limiting
</h3><div style=
"clear:left"></div>
709 <div class=
"paragraph"><p>Besides specifying a range of commits that should be listed using the
710 special notations explained in the description, additional commit
711 limiting may be applied.
</p></div>
712 <div class=
"dlist"><dl>
717 --max-count=
<number
>
721 Limit the number of commits output.
725 --skip=
<number
>
729 Skip
<em>number
</em> commits before starting to show the commit output.
740 Show commits more recent than a specific date.
747 --before=
<date
>
751 Show commits older than a specific date.
755 --max-age=
<timestamp
>
758 --min-age=
<timestamp
>
762 Limit the commits output to specified time range.
766 --author=
<pattern
>
769 --committer=
<pattern
>
773 Limit the commits output to ones with author/committer
774 header lines that match the specified pattern (regular expression).
778 --grep=
<pattern
>
782 Limit the commits output to ones with log message that
783 matches the specified pattern (regular expression).
791 Limit the commits output to ones that match all given --grep,
792 --author and --committer instead of ones that match at least one.
803 Match the regexp limiting patterns without regard to letters case.
814 Consider the limiting patterns to be extended regular expressions
815 instead of the default basic regular expressions.
826 Consider the limiting patterns to be fixed strings (don
’t interpret
827 pattern as a regular expression).
835 Stop when a given path disappears from the tree.
843 Print only merge commits.
851 Do not print commits with more than one parent.
859 Follow only the first parent commit upon seeing a merge
860 commit. This option can give a better overview when
861 viewing the evolution of a particular topic branch,
862 because merges into a topic branch tend to be only about
863 adjusting to updated upstream from time to time, and
864 this option allows you to ignore the individual commits
865 brought in to your history by such a merge.
873 Reverses the meaning of the
<em>^</em> prefix (or lack thereof)
874 for all following revision specifiers, up to the next
<em>--not
</em>.
882 Pretend as if all the refs in
<tt>refs/
</tt> are listed on the
883 command line as
<em><commit
></em>.
887 --branches[=
<pattern
>]
891 Pretend as if all the refs in
<tt>refs/heads
</tt> are listed
892 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
893 branches to ones matching given shell glob. If pattern lacks
<em>?
</em>,
894 <em><strong></em>, or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
898 --tags[=
<pattern
>]
902 Pretend as if all the refs in
<tt>refs/tags
</tt> are listed
903 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
904 tags to ones matching given shell glob. If pattern lacks
<em>?
</em>,
<em><strong></em>,
905 or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
909 --remotes[=
<pattern
>]
913 Pretend as if all the refs in
<tt>refs/remotes
</tt> are listed
914 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
915 remote-tracking branches to ones matching given shell glob.
916 If pattern lacks
<em>?
</em>,
<em><strong></em>, or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
920 --glob=
<glob-pattern
>
924 Pretend as if all the refs matching shell glob
<em><glob-pattern
></em>
925 are listed on the command line as
<em><commit
></em>. Leading
<em>refs/
</em>,
926 is automatically prepended if missing. If pattern lacks
<em>?
</em>,
<em><strong></em>,
927 or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
935 In addition to the
<em><commit
></em> listed on the command
936 line, read them from the standard input. If a
<em>--
</em> separator is
937 seen, stop reading commits and start reading paths to limit the
946 Don
’t print anything to standard output. This form
947 is primarily meant to allow the caller to
948 test the exit status to see if a range of objects is fully
949 connected (or not). It is faster than redirecting stdout
950 to /dev/null as the output does not have to be formatted.
958 Omit any commit that introduces the same change as
959 another commit on the
"other side" when the set of
960 commits are limited with symmetric difference.
962 <div class=
"paragraph"><p>For example, if you have two branches,
<tt>A
</tt> and
<tt>B
</tt>, a usual way
963 to list all commits on only one side of them is with
964 <tt>--left-right
</tt>, like the example above in the description of
965 that option. It however shows the commits that were cherry-picked
966 from the other branch (for example,
"3rd on b" may be cherry-picked
967 from branch A). With this option, such pairs of commits are
968 excluded from the output.
</p></div>
978 Instead of walking the commit ancestry chain, walk
979 reflog entries from the most recent one to older ones.
980 When this option is used you cannot specify commits to
981 exclude (that is,
<em>^commit
</em>,
<em>commit1..commit2
</em>,
982 nor
<em>commit1...commit2
</em> notations cannot be used).
984 <div class=
"paragraph"><p>With
<em>--pretty
</em> format other than oneline (for obvious reasons),
985 this causes the output to have two extra lines of information
986 taken from the reflog. By default,
<em>commit@{Nth}
</em> notation is
987 used in the output. When the starting commit is specified as
988 <em>commit@{now}
</em>, output also uses
<em>commit@{timestamp}
</em> notation
989 instead. Under
<em>--pretty=oneline
</em>, the commit message is
990 prefixed with this information on the same line.
991 This option cannot be combined with
<em>--reverse
</em>.
992 See also
<a href=
"git-reflog.html">git-reflog(
1)
</a>.
</p></div>
999 After a failed merge, show refs that touch files having a
1000 conflict and don
’t exist on all heads to merge.
1003 <dt class=
"hdlist1">
1008 Output uninteresting commits at the boundary, which are usually
1013 <h3 id=
"_history_simplification">History Simplification
</h3><div style=
"clear:left"></div>
1014 <div class=
"paragraph"><p>Sometimes you are only interested in parts of the history, for example the
1015 commits modifying a particular
<path
>. But there are two parts of
1016 <em>History Simplification
</em>, one part is selecting the commits and the other
1017 is how to do it, as there are various strategies to simplify the history.
</p></div>
1018 <div class=
"paragraph"><p>The following options select the commits to be shown:
</p></div>
1019 <div class=
"dlist"><dl>
1020 <dt class=
"hdlist1">
1025 Commits modifying the given
<paths
> are selected.
1028 <dt class=
"hdlist1">
1029 --simplify-by-decoration
1033 Commits that are referred by some branch or tag are selected.
1037 <div class=
"paragraph"><p>Note that extra commits can be shown to give a meaningful history.
</p></div>
1038 <div class=
"paragraph"><p>The following options affect the way the simplification is performed:
</p></div>
1039 <div class=
"dlist"><dl>
1040 <dt class=
"hdlist1">
1045 Simplifies the history to the simplest history explaining the
1046 final state of the tree. Simplest because it prunes some side
1047 branches if the end result is the same (i.e. merging branches
1048 with the same content)
1051 <dt class=
"hdlist1">
1056 As the default mode but does not prune some history.
1059 <dt class=
"hdlist1">
1064 Only the selected commits are shown, plus some to have a
1068 <dt class=
"hdlist1">
1073 All commits in the simplified history are shown.
1076 <dt class=
"hdlist1">
1081 Additional option to
<em>--full-history
</em> to remove some needless
1082 merges from the resulting history, as there are no selected
1083 commits contributing to this merge.
1086 <dt class=
"hdlist1">
1091 When given a range of commits to display (e.g.
<em>commit1..commit2
</em>
1092 or
<em>commit2
^commit1
</em>), only display commits that exist
1093 directly on the ancestry chain between the
<em>commit1
</em> and
1094 <em>commit2
</em>, i.e. commits that are both descendants of
<em>commit1
</em>,
1095 and ancestors of
<em>commit2
</em>.
1099 <div class=
"paragraph"><p>A more detailed explanation follows.
</p></div>
1100 <div class=
"paragraph"><p>Suppose you specified
<tt>foo
</tt> as the
<paths
>. We shall call commits
1101 that modify
<tt>foo
</tt> !TREESAME, and the rest TREESAME. (In a diff
1102 filtered for
<tt>foo
</tt>, they look different and equal, respectively.)
</p></div>
1103 <div class=
"paragraph"><p>In the following, we will always refer to the same example history to
1104 illustrate the differences between simplification settings. We assume
1105 that you are filtering for a file
<tt>foo
</tt> in this commit graph:
</p></div>
1106 <div class=
"listingblock">
1107 <div class=
"content">
1108 <pre><tt> .-A---M---N---O---P
1112 `-------------'
</tt></pre>
1114 <div class=
"paragraph"><p>The horizontal line of history A
—P is taken to be the first parent of
1115 each merge. The commits are:
</p></div>
1116 <div class=
"ulist"><ul>
1119 <tt>I
</tt> is the initial commit, in which
<tt>foo
</tt> exists with contents
1120 "asdf", and a file
<tt>quux
</tt> exists with contents
"quux". Initial
1121 commits are compared to an empty tree, so
<tt>I
</tt> is !TREESAME.
1126 In
<tt>A
</tt>,
<tt>foo
</tt> contains just
"foo".
1131 <tt>B
</tt> contains the same change as
<tt>A
</tt>. Its merge
<tt>M
</tt> is trivial and
1132 hence TREESAME to all parents.
1137 <tt>C
</tt> does not change
<tt>foo
</tt>, but its merge
<tt>N
</tt> changes it to
"foobar",
1138 so it is not TREESAME to any parent.
1143 <tt>D
</tt> sets
<tt>foo
</tt> to
"baz". Its merge
<tt>O
</tt> combines the strings from
1144 <tt>N
</tt> and
<tt>D
</tt> to
"foobarbaz"; i.e., it is not TREESAME to any parent.
1149 <tt>E
</tt> changes
<tt>quux
</tt> to
"xyzzy", and its merge
<tt>P
</tt> combines the
1150 strings to
"quux xyzzy". Despite appearing interesting,
<tt>P
</tt> is
1151 TREESAME to all parents.
1155 <div class=
"paragraph"><p><em>rev-list
</em> walks backwards through history, including or excluding
1156 commits based on whether
<em>--full-history
</em> and/or parent rewriting
1157 (via
<em>--parents
</em> or
<em>--children
</em>) are used. The following settings
1158 are available.
</p></div>
1159 <div class=
"dlist"><dl>
1160 <dt class=
"hdlist1">
1165 Commits are included if they are not TREESAME to any parent
1166 (though this can be changed, see
<em>--sparse
</em> below). If the
1167 commit was a merge, and it was TREESAME to one parent, follow
1168 only that parent. (Even if there are several TREESAME
1169 parents, follow only one of them.) Otherwise, follow all
1172 <div class=
"paragraph"><p>This results in:
</p></div>
1173 <div class=
"listingblock">
1174 <div class=
"content">
1175 <pre><tt> .-A---N---O
1177 I---------D
</tt></pre>
1179 <div class=
"paragraph"><p>Note how the rule to only follow the TREESAME parent, if one is
1180 available, removed
<tt>B
</tt> from consideration entirely.
<tt>C
</tt> was
1181 considered via
<tt>N
</tt>, but is TREESAME. Root commits are compared to an
1182 empty tree, so
<tt>I
</tt> is !TREESAME.
</p></div>
1183 <div class=
"paragraph"><p>Parent/child relations are only visible with --parents, but that does
1184 not affect the commits selected in default mode, so we have shown the
1185 parent lines.
</p></div>
1187 <dt class=
"hdlist1">
1188 --full-history without parent rewriting
1192 This mode differs from the default in one point: always follow
1193 all parents of a merge, even if it is TREESAME to one of them.
1194 Even if more than one side of the merge has commits that are
1195 included, this does not imply that the merge itself is! In
1198 <div class=
"listingblock">
1199 <div class=
"content">
1200 <pre><tt> I A B N D O
</tt></pre>
1202 <div class=
"paragraph"><p><tt>P
</tt> and
<tt>M
</tt> were excluded because they are TREESAME to a parent.
<tt>E
</tt>,
1203 <tt>C
</tt> and
<tt>B
</tt> were all walked, but only
<tt>B
</tt> was !TREESAME, so the others
1204 do not appear.
</p></div>
1205 <div class=
"paragraph"><p>Note that without parent rewriting, it is not really possible to talk
1206 about the parent/child relationships between the commits, so we show
1207 them disconnected.
</p></div>
1209 <dt class=
"hdlist1">
1210 --full-history with parent rewriting
1214 Ordinary commits are only included if they are !TREESAME
1215 (though this can be changed, see
<em>--sparse
</em> below).
1217 <div class=
"paragraph"><p>Merges are always included. However, their parent list is rewritten:
1218 Along each parent, prune away commits that are not included
1219 themselves. This results in
</p></div>
1220 <div class=
"listingblock">
1221 <div class=
"content">
1222 <pre><tt> .-A---M---N---O---P
1226 `-------------'
</tt></pre>
1228 <div class=
"paragraph"><p>Compare to
<em>--full-history
</em> without rewriting above. Note that
<tt>E
</tt>
1229 was pruned away because it is TREESAME, but the parent list of P was
1230 rewritten to contain
<tt>E
</tt>'s parent
<tt>I
</tt>. The same happened for
<tt>C
</tt> and
1231 <tt>N
</tt>. Note also that
<tt>P
</tt> was included despite being TREESAME.
</p></div>
1234 <div class=
"paragraph"><p>In addition to the above settings, you can change whether TREESAME
1235 affects inclusion:
</p></div>
1236 <div class=
"dlist"><dl>
1237 <dt class=
"hdlist1">
1242 Commits that are walked are included if they are not TREESAME
1246 <dt class=
"hdlist1">
1251 All commits that are walked are included.
1253 <div class=
"paragraph"><p>Note that without
<em>--full-history
</em>, this still simplifies merges: if
1254 one of the parents is TREESAME, we follow only that one, so the other
1255 sides of the merge are never walked.
</p></div>
1257 <dt class=
"hdlist1">
1262 First, build a history graph in the same way that
1263 <em>--full-history
</em> with parent rewriting does (see above).
1265 <div class=
"paragraph"><p>Then simplify each commit
‘C` to its replacement
<tt>C
’</tt> in the final
1266 history according to the following rules:
</p></div>
1267 <div class=
"ulist"><ul>
1270 Set
‘C
’` to
<tt>C
</tt>.
1275 Replace each parent
‘P` of
<tt>C
’</tt> with its simplification
‘P
’`. In
1276 the process, drop parents that are ancestors of other parents, and
1282 If after this parent rewriting,
‘C
’` is a root or merge commit (has
1283 zero or
>1 parents), a boundary commit, or !TREESAME, it remains.
1284 Otherwise, it is replaced with its only parent.
1288 <div class=
"paragraph"><p>The effect of this is best shown by way of comparing to
1289 <em>--full-history
</em> with parent rewriting. The example turns into:
</p></div>
1290 <div class=
"listingblock">
1291 <div class=
"content">
1292 <pre><tt> .-A---M---N---O
1296 `---------'
</tt></pre>
1298 <div class=
"paragraph"><p>Note the major differences in
<tt>N
</tt> and
<tt>P
</tt> over
<em>--full-history
</em>:
</p></div>
1299 <div class=
"ulist"><ul>
1302 <tt>N
</tt>'s parent list had
<tt>I
</tt> removed, because it is an ancestor of the
1303 other parent
<tt>M
</tt>. Still,
<tt>N
</tt> remained because it is !TREESAME.
1308 <tt>P
</tt>'s parent list similarly had
<tt>I
</tt> removed.
<tt>P
</tt> was then
1309 removed completely, because it had one parent and is TREESAME.
1315 <div class=
"paragraph"><p>Finally, there is a fifth simplification mode available:
</p></div>
1316 <div class=
"dlist"><dl>
1317 <dt class=
"hdlist1">
1322 Limit the displayed commits to those directly on the ancestry
1323 chain between the
"from" and
"to" commits in the given commit
1324 range. I.e. only display commits that are ancestor of the
"to"
1325 commit, and descendants of the
"from" commit.
1327 <div class=
"paragraph"><p>As an example use case, consider the following commit history:
</p></div>
1328 <div class=
"listingblock">
1329 <div class=
"content">
1330 <pre><tt> D---E-------F
1332 B---C---G---H---I---J
1334 A-------K---------------L--M
</tt></pre>
1336 <div class=
"paragraph"><p>A regular
<em>D..M
</em> computes the set of commits that are ancestors of
<tt>M
</tt>,
1337 but excludes the ones that are ancestors of
<tt>D
</tt>. This is useful to see
1338 what happened to the history leading to
<tt>M
</tt> since
<tt>D
</tt>, in the sense
1339 that
"what does <tt>M</tt> have that did not exist in <tt>D</tt>". The result in this
1340 example would be all the commits, except
<tt>A
</tt> and
<tt>B
</tt> (and
<tt>D
</tt> itself,
1341 of course).
</p></div>
1342 <div class=
"paragraph"><p>When we want to find out what commits in
<tt>M
</tt> are contaminated with the
1343 bug introduced by
<tt>D
</tt> and need fixing, however, we might want to view
1344 only the subset of
<em>D..M
</em> that are actually descendants of
<tt>D
</tt>, i.e.
1345 excluding
<tt>C
</tt> and
<tt>K
</tt>. This is exactly what the
<em>--ancestry-path
</em>
1346 option does. Applied to the
<em>D..M
</em> range, it results in:
</p></div>
1347 <div class=
"listingblock">
1348 <div class=
"content">
1357 <div class=
"paragraph"><p>The
<em>--simplify-by-decoration
</em> option allows you to view only the
1358 big picture of the topology of the history, by omitting commits
1359 that are not referenced by tags. Commits are marked as !TREESAME
1360 (in other words, kept after history simplification rules described
1361 above) if (
1) they are referenced by tags, or (
2) they change the
1362 contents of the paths given on the command line. All other
1363 commits are marked as TREESAME (subject to be simplified away).
</p></div>
1364 <h3 id=
"_bisection_helpers">Bisection Helpers
</h3><div style=
"clear:left"></div>
1365 <div class=
"dlist"><dl>
1366 <dt class=
"hdlist1">
1371 Limit output to the one commit object which is roughly halfway between
1372 included and excluded commits. Note that the bad bisection ref
1373 <tt>refs/bisect/bad
</tt> is added to the included commits (if it
1374 exists) and the good bisection refs
<tt>refs/bisect/good-*
</tt> are
1375 added to the excluded commits (if they exist). Thus, supposing there
1376 are no refs in
<tt>refs/bisect/
</tt>, if
1380 <div class=
"listingblock">
1381 <div class=
"content">
1382 <pre><tt> $ git rev-list --bisect foo ^bar ^baz
</tt></pre>
1384 <div class=
"paragraph"><p>outputs
<em>midpoint
</em>, the output of the two commands
</p></div>
1385 <div class=
"listingblock">
1386 <div class=
"content">
1387 <pre><tt> $ git rev-list foo ^midpoint
1388 $ git rev-list midpoint ^bar ^baz
</tt></pre>
1390 <div class=
"paragraph"><p>would be of roughly the same length. Finding the change which
1391 introduces a regression is thus reduced to a binary search: repeatedly
1392 generate and test new 'midpoint
’s until the commit chain is of length
1394 <div class=
"dlist"><dl>
1395 <dt class=
"hdlist1">
1400 This calculates the same as
<tt>--bisect
</tt>, except that refs in
1401 <tt>refs/bisect/
</tt> are not used, and except that this outputs
1402 text ready to be eval
’ed by the shell. These lines will assign the
1403 name of the midpoint revision to the variable
<tt>bisect_rev
</tt>, and the
1404 expected number of commits to be tested after
<tt>bisect_rev
</tt> is tested
1405 to
<tt>bisect_nr
</tt>, the expected number of commits to be tested if
1406 <tt>bisect_rev
</tt> turns out to be good to
<tt>bisect_good
</tt>, the expected
1407 number of commits to be tested if
<tt>bisect_rev
</tt> turns out to be bad to
1408 <tt>bisect_bad
</tt>, and the number of commits we are bisecting right now to
1409 <tt>bisect_all
</tt>.
1412 <dt class=
"hdlist1">
1417 This outputs all the commit objects between the included and excluded
1418 commits, ordered by their distance to the included and excluded
1419 commits. Refs in
<tt>refs/bisect/
</tt> are not used. The farthest
1420 from them is displayed first. (This is the only one displayed by
1423 <div class=
"paragraph"><p>This is useful because it makes it easy to choose a good commit to
1424 test when you want to avoid to test some of them for some reason (they
1425 may not compile for example).
</p></div>
1426 <div class=
"paragraph"><p>This option can be used along with
<tt>--bisect-vars
</tt>, in this case,
1427 after all the sorted commit objects, there will be the same text as if
1428 <tt>--bisect-vars
</tt> had been used alone.
</p></div>
1431 <h3 id=
"_commit_ordering">Commit Ordering
</h3><div style=
"clear:left"></div>
1432 <div class=
"paragraph"><p>By default, the commits are shown in reverse chronological order.
</p></div>
1433 <div class=
"dlist"><dl>
1434 <dt class=
"hdlist1">
1439 This option makes them appear in topological order (i.e.
1440 descendant commits are shown before their parents).
1443 <dt class=
"hdlist1">
1448 This option is similar to
<em>--topo-order
</em> in the sense that no
1449 parent comes before all of its children, but otherwise things
1450 are still ordered in the commit timestamp order.
1453 <dt class=
"hdlist1">
1458 Output the commits in reverse order.
1459 Cannot be combined with
<em>--walk-reflogs
</em>.
1463 <h3 id=
"_object_traversal">Object Traversal
</h3><div style=
"clear:left"></div>
1464 <div class=
"paragraph"><p>These options are mostly targeted for packing of git repositories.
</p></div>
1465 <div class=
"dlist"><dl>
1466 <dt class=
"hdlist1">
1471 Print the object IDs of any object referenced by the listed
1472 commits.
<em>--objects foo ^bar
</em> thus means
"send me
1473 all object IDs which I need to download if I have the commit
1474 object <em>bar</em>, but not <em>foo</em>".
1477 <dt class=
"hdlist1">
1482 Similar to
<em>--objects
</em>, but also print the IDs of excluded
1483 commits prefixed with a
"-" character. This is used by
1484 <a href=
"git-pack-objects.html">git-pack-objects(
1)
</a> to build
"thin" pack, which records
1485 objects in deltified form based on objects contained in these
1486 excluded commits to reduce network traffic.
1489 <dt class=
"hdlist1">
1494 Only useful with
<em>--objects
</em>; print the object IDs that are not
1498 <dt class=
"hdlist1">
1503 Only show the given revs, but do not traverse their ancestors.
1506 <dt class=
"hdlist1">
1511 Overrides a previous --no-walk.
1516 <h2 id=
"_pretty_formats">PRETTY FORMATS
</h2>
1517 <div class=
"sectionbody">
1518 <div class=
"paragraph"><p>If the commit is a merge, and if the pretty-format
1519 is not
<em>oneline
</em>,
<em>email
</em> or
<em>raw
</em>, an additional line is
1520 inserted before the
<em>Author:
</em> line. This line begins with
1521 "Merge: " and the sha1s of ancestral commits are printed,
1522 separated by spaces. Note that the listed commits may not
1523 necessarily be the list of the
<strong>direct
</strong> parent commits if you
1524 have limited your view of history: for example, if you are
1525 only interested in changes related to a certain directory or
1527 <div class=
"paragraph"><p>There are several built-in formats, and you can define
1528 additional formats by setting a pretty.
<name
>
1529 config option to either another format name, or a
1530 <em>format:
</em> string, as described below (see
1531 <a href=
"git-config.html">git-config(
1)
</a>). Here are the details of the
1532 built-in formats:
</p></div>
1533 <div class=
"ulist"><ul>
1538 <div class=
"literalblock">
1539 <div class=
"content">
1540 <pre><tt><sha1
> <title line
></tt></pre>
1542 <div class=
"paragraph"><p>This is designed to be as compact as possible.
</p></div>
1548 <div class=
"literalblock">
1549 <div class=
"content">
1550 <pre><tt>commit
<sha1
>
1551 Author:
<author
></tt></pre>
1553 <div class=
"literalblock">
1554 <div class=
"content">
1555 <pre><tt><title line
></tt></pre>
1562 <div class=
"literalblock">
1563 <div class=
"content">
1564 <pre><tt>commit
<sha1
>
1565 Author:
<author
>
1566 Date:
<author date
></tt></pre>
1568 <div class=
"literalblock">
1569 <div class=
"content">
1570 <pre><tt><title line
></tt></pre>
1572 <div class=
"literalblock">
1573 <div class=
"content">
1574 <pre><tt><full commit message
></tt></pre>
1581 <div class=
"literalblock">
1582 <div class=
"content">
1583 <pre><tt>commit
<sha1
>
1584 Author:
<author
>
1585 Commit:
<committer
></tt></pre>
1587 <div class=
"literalblock">
1588 <div class=
"content">
1589 <pre><tt><title line
></tt></pre>
1591 <div class=
"literalblock">
1592 <div class=
"content">
1593 <pre><tt><full commit message
></tt></pre>
1600 <div class=
"literalblock">
1601 <div class=
"content">
1602 <pre><tt>commit
<sha1
>
1603 Author:
<author
>
1604 AuthorDate:
<author date
>
1605 Commit:
<committer
>
1606 CommitDate:
<committer date
></tt></pre>
1608 <div class=
"literalblock">
1609 <div class=
"content">
1610 <pre><tt><title line
></tt></pre>
1612 <div class=
"literalblock">
1613 <div class=
"content">
1614 <pre><tt><full commit message
></tt></pre>
1621 <div class=
"literalblock">
1622 <div class=
"content">
1623 <pre><tt>From
<sha1
> <date
>
1624 From:
<author
>
1625 Date:
<author date
>
1626 Subject: [PATCH]
<title line
></tt></pre>
1628 <div class=
"literalblock">
1629 <div class=
"content">
1630 <pre><tt><full commit message
></tt></pre>
1637 <div class=
"paragraph"><p>The
<em>raw
</em> format shows the entire commit exactly as
1638 stored in the commit object. Notably, the SHA1s are
1639 displayed in full, regardless of whether --abbrev or
1640 --no-abbrev are used, and
<em>parents
</em> information show the
1641 true parent commits, without taking grafts nor history
1642 simplification into account.
</p></div>
1646 <em>format:
<string
></em>
1648 <div class=
"paragraph"><p>The
<em>format:
<string
></em> format allows you to specify which information
1649 you want to show. It works a little bit like printf format,
1650 with the notable exception that you get a newline with
<em>%n
</em>
1651 instead of
<em>\n
</em>.
</p></div>
1652 <div class=
"paragraph"><p>E.g,
<em>format:
"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em>
1653 would show something like this:
</p></div>
1654 <div class=
"listingblock">
1655 <div class=
"content">
1656 <pre><tt>The author of fe6e0ee was Junio C Hamano,
23 hours ago
1657 The title was
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<</tt></pre>
1659 <div class=
"paragraph"><p>The placeholders are:
</p></div>
1660 <div class=
"ulist"><ul>
1663 <em>%H
</em>: commit hash
1668 <em>%h
</em>: abbreviated commit hash
1673 <em>%T
</em>: tree hash
1678 <em>%t
</em>: abbreviated tree hash
1683 <em>%P
</em>: parent hashes
1688 <em>%p
</em>: abbreviated parent hashes
1693 <em>%an
</em>: author name
1698 <em>%aN
</em>: author name (respecting .mailmap, see
<a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
1703 <em>%ae
</em>: author email
1708 <em>%aE
</em>: author email (respecting .mailmap, see
<a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
1713 <em>%ad
</em>: author date (format respects --date= option)
1718 <em>%aD
</em>: author date, RFC2822 style
1723 <em>%ar
</em>: author date, relative
1728 <em>%at
</em>: author date, UNIX timestamp
1733 <em>%ai
</em>: author date, ISO
8601 format
1738 <em>%cn
</em>: committer name
1743 <em>%cN
</em>: committer name (respecting .mailmap, see
<a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
1748 <em>%ce
</em>: committer email
1753 <em>%cE
</em>: committer email (respecting .mailmap, see
<a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
1758 <em>%cd
</em>: committer date
1763 <em>%cD
</em>: committer date, RFC2822 style
1768 <em>%cr
</em>: committer date, relative
1773 <em>%ct
</em>: committer date, UNIX timestamp
1778 <em>%ci
</em>: committer date, ISO
8601 format
1783 <em>%d
</em>: ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
1788 <em>%e
</em>: encoding
1793 <em>%s
</em>: subject
1798 <em>%f
</em>: sanitized subject line, suitable for a filename
1808 <em>%B
</em>: raw body (unwrapped subject and body)
1813 <em>%N
</em>: commit notes
1818 <em>%gD
</em>: reflog selector, e.g.,
<tt>refs/stash@{
1}
</tt>
1823 <em>%gd
</em>: shortened reflog selector, e.g.,
<tt>stash@{
1}
</tt>
1828 <em>%gs
</em>: reflog subject
1833 <em>%Cred
</em>: switch color to red
1838 <em>%Cgreen
</em>: switch color to green
1843 <em>%Cblue
</em>: switch color to blue
1848 <em>%Creset
</em>: reset color
1853 <em>%C(
…)
</em>: color specification, as described in color.branch.* config option
1858 <em>%m
</em>: left, right or boundary mark
1863 <em>%n
</em>: newline
1868 <em>%%
</em>: a raw
<em>%
</em>
1873 <em>%x00
</em>: print a byte from a hex code
1878 <em>%w([
<w
>[,
<i1
>[,
<i2
>]]])
</em>: switch line wrapping, like the -w option of
1879 <a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
1885 <div class=
"admonitionblock">
1888 <div class=
"title">Note
</div>
1890 <td class=
"content">Some placeholders may depend on other options given to the
1891 revision traversal engine. For example, the
<tt>%g*
</tt> reflog options will
1892 insert an empty string unless we are traversing reflog entries (e.g., by
1893 <tt>git log -g
</tt>). The
<tt>%d
</tt> placeholder will use the
"short" decoration
1894 format if
<tt>--decorate
</tt> was not already provided on the command line.
</td>
1897 <div class=
"paragraph"><p>If you add a
<tt>+</tt> (plus sign) after
<em>%
</em> of a placeholder, a line-feed
1898 is inserted immediately before the expansion if and only if the
1899 placeholder expands to a non-empty string.
</p></div>
1900 <div class=
"paragraph"><p>If you add a
<tt>-
</tt> (minus sign) after
<em>%
</em> of a placeholder, line-feeds that
1901 immediately precede the expansion are deleted if and only if the
1902 placeholder expands to an empty string.
</p></div>
1903 <div class=
"paragraph"><p>If you add a ` ` (space) after
<em>%
</em> of a placeholder, a space
1904 is inserted immediately before the expansion if and only if the
1905 placeholder expands to a non-empty string.
</p></div>
1906 <div class=
"ulist"><ul>
1911 <div class=
"paragraph"><p>The
<em>tformat:
</em> format works exactly like
<em>format:
</em>, except that it
1912 provides
"terminator" semantics instead of
"separator" semantics. In
1913 other words, each commit has the message terminator character (usually a
1914 newline) appended, rather than a separator placed between entries.
1915 This means that the final entry of a single-line format will be properly
1916 terminated with a new line, just as the
"oneline" format does.
1917 For example:
</p></div>
1918 <div class=
"listingblock">
1919 <div class=
"content">
1920 <pre><tt>$ git log -
2 --pretty=format:%h
4da45bef \
1921 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
1923 7134973 -- NO NEWLINE
1925 $ git log -
2 --pretty=tformat:%h
4da45bef \
1926 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
1930 <div class=
"paragraph"><p>In addition, any unrecognized string that has a
<tt>%
</tt> in it is interpreted
1931 as if it has
<tt>tformat:
</tt> in front of it. For example, these two are
1932 equivalent:
</p></div>
1933 <div class=
"listingblock">
1934 <div class=
"content">
1935 <pre><tt>$ git log -
2 --pretty=tformat:%h
4da45bef
1936 $ git log -
2 --pretty=%h
4da45bef
</tt></pre>
1941 <h2 id=
"_author">Author
</h2>
1942 <div class=
"sectionbody">
1943 <div class=
"paragraph"><p>Written by Linus Torvalds
<<a href=
"mailto:torvalds@osdl.org">torvalds@osdl.org
</a>></p></div>
1945 <h2 id=
"_documentation">Documentation
</h2>
1946 <div class=
"sectionbody">
1947 <div class=
"paragraph"><p>Documentation by David Greaves, Junio C Hamano, Jonas Fonseca
1948 and the git-list
<<a href=
"mailto:git@vger.kernel.org">git@vger.kernel.org
</a>>.
</p></div>
1950 <h2 id=
"_git">GIT
</h2>
1951 <div class=
"sectionbody">
1952 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1955 <div id=
"footer-text">
1956 Last updated
2010-
11-
06 00:
41:
57 UTC