git-rev-list.1   [plain text]


'\" t
.\"     Title: git-rev-list
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\"      Date: 06/01/2011
.\"    Manual: Git Manual
.\"    Source: Git 1.7.5.4
.\"  Language: English
.\"
.TH "GIT\-REV\-LIST" "1" "06/01/2011" "Git 1\&.7\&.5\&.4" "Git Manual"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-rev-list \- Lists commit objects in reverse chronological order
.SH "SYNOPSIS"
.sp
.nf
\fIgit rev\-list\fR [ \-\-max\-count=<number> ]
             [ \-\-skip=<number> ]
             [ \-\-max\-age=<timestamp> ]
             [ \-\-min\-age=<timestamp> ]
             [ \-\-sparse ]
             [ \-\-merges ]
             [ \-\-no\-merges ]
             [ \-\-min\-parents=<number> ]
             [ \-\-no\-min\-parents ]
             [ \-\-max\-parents=<number> ]
             [ \-\-no\-max\-parents ]
             [ \-\-first\-parent ]
             [ \-\-remove\-empty ]
             [ \-\-full\-history ]
             [ \-\-not ]
             [ \-\-all ]
             [ \-\-branches[=<pattern>] ]
             [ \-\-tags[=<pattern>] ]
             [ \-\-remotes[=<pattern>] ]
             [ \-\-glob=<glob\-pattern> ]
             [ \-\-stdin ]
             [ \-\-quiet ]
             [ \-\-topo\-order ]
             [ \-\-parents ]
             [ \-\-timestamp ]
             [ \-\-left\-right ]
             [ \-\-left\-only ]
             [ \-\-right\-only ]
             [ \-\-cherry\-mark ]
             [ \-\-cherry\-pick ]
             [ \-\-encoding[=<encoding>] ]
             [ \-\-(author|committer|grep)=<pattern> ]
             [ \-\-regexp\-ignore\-case | \-i ]
             [ \-\-extended\-regexp | \-E ]
             [ \-\-fixed\-strings | \-F ]
             [ \-\-date=(local|relative|default|iso|rfc|short) ]
             [ [\-\-objects | \-\-objects\-edge] [ \-\-unpacked ] ]
             [ \-\-pretty | \-\-header ]
             [ \-\-bisect ]
             [ \-\-bisect\-vars ]
             [ \-\-bisect\-all ]
             [ \-\-merge ]
             [ \-\-reverse ]
             [ \-\-walk\-reflogs ]
             [ \-\-no\-walk ] [ \-\-do\-walk ]
             <commit>\&... [ \-\- <paths>\&... ]
.fi
.sp
.SH "DESCRIPTION"
.sp
List commits that are reachable by following the parent links from the given commit(s), but exclude commits that are reachable from the one(s) given with a \fI^\fR in front of them\&. The output is given in reverse chronological order by default\&.
.sp
You can think of this as a set operation\&. Commits given on the command line form a set of commits that are reachable from any of them, and then commits reachable from any of the ones given with \fI^\fR in front are subtracted from that set\&. The remaining commits are what comes out in the command\(cqs output\&. Various other options and paths parameters can be used to further limit the result\&.
.sp
Thus, the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
        $ git rev\-list foo bar ^baz
.fi
.if n \{\
.RE
.\}
.sp
.sp
means "list all the commits which are reachable from \fIfoo\fR or \fIbar\fR, but not from \fIbaz\fR"\&.
.sp
A special notation "\fI<commit1>\fR\&.\&.\fI<commit2>\fR" can be used as a short\-hand for "^\fI<commit1>\fR \fI<commit2>\fR"\&. For example, either of the following may be used interchangeably:
.sp
.if n \{\
.RS 4
.\}
.nf
        $ git rev\-list origin\&.\&.HEAD
        $ git rev\-list HEAD ^origin
.fi
.if n \{\
.RE
.\}
.sp
.sp
Another special notation is "\fI<commit1>\fR\&...\fI<commit2>\fR" which is useful for merges\&. The resulting set of commits is the symmetric difference between the two operands\&. The following two commands are equivalent:
.sp
.if n \{\
.RS 4
.\}
.nf
        $ git rev\-list A B \-\-not $(git merge\-base \-\-all A B)
        $ git rev\-list A\&.\&.\&.B
.fi
.if n \{\
.RE
.\}
.sp
.sp
\fIrev\-list\fR is a very essential git command, since it provides the ability to build and traverse commit ancestry graphs\&. For this reason, it has a lot of different options that enables it to be used by commands as different as \fIgit bisect\fR and \fIgit repack\fR\&.
.SH "OPTIONS"
.SS "Commit Limiting"
.sp
Besides specifying a range of commits that should be listed using the special notations explained in the description, additional commit limiting may be applied\&. Note that they are applied before commit ordering and formatting options, such as \fI\-\-reverse\fR\&.
.PP
\-n \fInumber\fR, \-\-max\-count=<number>
.RS 4
Limit the number of commits to output\&.
.RE
.PP
\-\-skip=<number>
.RS 4
Skip
\fInumber\fR
commits before starting to show the commit output\&.
.RE
.PP
\-\-since=<date>, \-\-after=<date>
.RS 4
Show commits more recent than a specific date\&.
.RE
.PP
\-\-until=<date>, \-\-before=<date>
.RS 4
Show commits older than a specific date\&.
.RE
.PP
\-\-max\-age=<timestamp>, \-\-min\-age=<timestamp>
.RS 4
Limit the commits output to specified time range\&.
.RE
.PP
\-\-author=<pattern>, \-\-committer=<pattern>
.RS 4
Limit the commits output to ones with author/committer header lines that match the specified pattern (regular expression)\&.
.RE
.PP
\-\-grep=<pattern>
.RS 4
Limit the commits output to ones with log message that matches the specified pattern (regular expression)\&.
.RE
.PP
\-\-all\-match
.RS 4
Limit the commits output to ones that match all given \-\-grep, \-\-author and \-\-committer instead of ones that match at least one\&.
.RE
.PP
\-i, \-\-regexp\-ignore\-case
.RS 4
Match the regexp limiting patterns without regard to letters case\&.
.RE
.PP
\-E, \-\-extended\-regexp
.RS 4
Consider the limiting patterns to be extended regular expressions instead of the default basic regular expressions\&.
.RE
.PP
\-F, \-\-fixed\-strings
.RS 4
Consider the limiting patterns to be fixed strings (don\(cqt interpret pattern as a regular expression)\&.
.RE
.PP
\-\-remove\-empty
.RS 4
Stop when a given path disappears from the tree\&.
.RE
.PP
\-\-merges
.RS 4
Print only merge commits\&. This is exactly the same as
\-\-min\-parents=2\&.
.RE
.PP
\-\-no\-merges
.RS 4
Do not print commits with more than one parent\&. This is exactly the same as
\-\-max\-parents=1\&.
.RE
.PP
\-\-min\-parents=<number>, \-\-max\-parents=<number>, \-\-no\-min\-parents, \-\-no\-max\-parents
.RS 4
Show only commits which have at least (or at most) that many commits\&. In particular,
\-\-max\-parents=1
is the same as
\-\-no\-merges,
\-\-min\-parents=2
is the same as
\-\-merges\&.
\-\-max\-parents=0
gives all root commits and
\-\-min\-parents=3
all octopus merges\&.
.sp
\-\-no\-min\-parents
and
\-\-no\-max\-parents
reset these limits (to no limit) again\&. Equivalent forms are
\-\-min\-parents=0
(any commit has 0 or more parents) and
\-\-max\-parents=\-1
(negative numbers denote no upper limit)\&.
.RE
.PP
\-\-first\-parent
.RS 4
Follow only the first parent commit upon seeing a merge commit\&. This option can give a better overview when viewing the evolution of a particular topic branch, because merges into a topic branch tend to be only about adjusting to updated upstream from time to time, and this option allows you to ignore the individual commits brought in to your history by such a merge\&.
.RE
.PP
\-\-not
.RS 4
Reverses the meaning of the
\fI^\fR
prefix (or lack thereof) for all following revision specifiers, up to the next
\fI\-\-not\fR\&.
.RE
.PP
\-\-all
.RS 4
Pretend as if all the refs in
refs/
are listed on the command line as
\fI<commit>\fR\&.
.RE
.PP
\-\-branches[=<pattern>]
.RS 4
Pretend as if all the refs in
refs/heads
are listed on the command line as
\fI<commit>\fR\&. If
\fI<pattern>\fR
is given, limit branches to ones matching given shell glob\&. If pattern lacks
\fI?\fR,
\fI\fR\fI, or \fR\fI\fI[\fR\fR\fI, \fR\fI\fI/\fR\fR
at the end is implied\&.
.RE
.PP
\-\-tags[=<pattern>]
.RS 4
Pretend as if all the refs in
refs/tags
are listed on the command line as
\fI<commit>\fR\&. If
\fI<pattern>\fR
is given, limit tags to ones matching given shell glob\&. If pattern lacks
\fI?\fR,
\fI\fR\fI, or \fR\fI\fI[\fR\fR\fI, \fR\fI\fI/\fR\fR
at the end is implied\&.
.RE
.PP
\-\-remotes[=<pattern>]
.RS 4
Pretend as if all the refs in
refs/remotes
are listed on the command line as
\fI<commit>\fR\&. If
\fI<pattern>\fR
is given, limit remote\-tracking branches to ones matching given shell glob\&. If pattern lacks
\fI?\fR,
\fI\fR\fI, or \fR\fI\fI[\fR\fR\fI, \fR\fI\fI/\fR\fR
at the end is implied\&.
.RE
.PP
\-\-glob=<glob\-pattern>
.RS 4
Pretend as if all the refs matching shell glob
\fI<glob\-pattern>\fR
are listed on the command line as
\fI<commit>\fR\&. Leading
\fIrefs/\fR, is automatically prepended if missing\&. If pattern lacks
\fI?\fR,
\fI\fR\fI, or \fR\fI\fI[\fR\fR\fI, \fR\fI\fI/\fR\fR
at the end is implied\&.
.RE
.PP
\-\-stdin
.RS 4
In addition to the
\fI<commit>\fR
listed on the command line, read them from the standard input\&. If a
\fI\-\-\fR
separator is seen, stop reading commits and start reading paths to limit the result\&.
.RE
.PP
\-\-quiet
.RS 4
Don\(cqt print anything to standard output\&. This form is primarily meant to allow the caller to test the exit status to see if a range of objects is fully connected (or not)\&. It is faster than redirecting stdout to /dev/null as the output does not have to be formatted\&.
.RE
.PP
\-\-cherry\-mark
.RS 4
Like
\-\-cherry\-pick
(see below) but mark equivalent commits with
=
rather than omitting them, and inequivalent ones with
+\&.
.RE
.PP
\-\-cherry\-pick
.RS 4
Omit any commit that introduces the same change as another commit on the "other side" when the set of commits are limited with symmetric difference\&.
.sp
For example, if you have two branches,
A
and
B, a usual way to list all commits on only one side of them is with
\-\-left\-right
(see the example below in the description of the
\-\-left\-right
option)\&. It however shows the commits that were cherry\-picked from the other branch (for example, "3rd on b" may be cherry\-picked from branch A)\&. With this option, such pairs of commits are excluded from the output\&.
.RE
.PP
\-\-left\-only, \-\-right\-only
.RS 4
List only commits on the respective side of a symmetric range, i\&.e\&. only those which would be marked
<
resp\&.
>
by
\-\-left\-right\&.
.sp
For example,
\-\-cherry\-pick \-\-right\-only A\&...B
omits those commits from
B
which are in
A
or are patch\-equivalent to a commit in
A\&. In other words, this lists the
+
commits from
git cherry A B\&. More precisely,
\-\-cherry\-pick \-\-right\-only \-\-no\-merges
gives the exact list\&.
.RE
.PP
\-\-cherry
.RS 4
A synonym for
\-\-right\-only \-\-cherry\-mark \-\-no\-merges; useful to limit the output to the commits on our side and mark those that have been applied to the other side of a forked history with
git log \-\-cherry upstream\&...mybranch, similar to
git cherry upstream mybranch\&.
.RE
.PP
\-g, \-\-walk\-reflogs
.RS 4
Instead of walking the commit ancestry chain, walk reflog entries from the most recent one to older ones\&. When this option is used you cannot specify commits to exclude (that is,
\fI^commit\fR,
\fIcommit1\&.\&.commit2\fR, nor
\fIcommit1\&.\&.\&.commit2\fR
notations cannot be used)\&.
.sp
With
\fI\-\-pretty\fR
format other than oneline (for obvious reasons), this causes the output to have two extra lines of information taken from the reflog\&. By default,
\fIcommit@{Nth}\fR
notation is used in the output\&. When the starting commit is specified as
\fIcommit@{now}\fR, output also uses
\fIcommit@{timestamp}\fR
notation instead\&. Under
\fI\-\-pretty=oneline\fR, the commit message is prefixed with this information on the same line\&. This option cannot be combined with
\fI\-\-reverse\fR\&. See also
\fBgit-reflog\fR(1)\&.
.RE
.PP
\-\-merge
.RS 4
After a failed merge, show refs that touch files having a conflict and don\(cqt exist on all heads to merge\&.
.RE
.PP
\-\-boundary
.RS 4
Output uninteresting commits at the boundary, which are usually not shown\&.
.RE
.SS "History Simplification"
.sp
Sometimes you are only interested in parts of the history, for example the commits modifying a particular <path>\&. But there are two parts of \fIHistory Simplification\fR, one part is selecting the commits and the other is how to do it, as there are various strategies to simplify the history\&.
.sp
The following options select the commits to be shown:
.PP
<paths>
.RS 4
Commits modifying the given <paths> are selected\&.
.RE
.PP
\-\-simplify\-by\-decoration
.RS 4
Commits that are referred by some branch or tag are selected\&.
.RE
.sp
Note that extra commits can be shown to give a meaningful history\&.
.sp
The following options affect the way the simplification is performed:
.PP
Default mode
.RS 4
Simplifies the history to the simplest history explaining the final state of the tree\&. Simplest because it prunes some side branches if the end result is the same (i\&.e\&. merging branches with the same content)
.RE
.PP
\-\-full\-history
.RS 4
As the default mode but does not prune some history\&.
.RE
.PP
\-\-dense
.RS 4
Only the selected commits are shown, plus some to have a meaningful history\&.
.RE
.PP
\-\-sparse
.RS 4
All commits in the simplified history are shown\&.
.RE
.PP
\-\-simplify\-merges
.RS 4
Additional option to
\fI\-\-full\-history\fR
to remove some needless merges from the resulting history, as there are no selected commits contributing to this merge\&.
.RE
.PP
\-\-ancestry\-path
.RS 4
When given a range of commits to display (e\&.g\&.
\fIcommit1\&.\&.commit2\fR
or
\fIcommit2 ^commit1\fR), only display commits that exist directly on the ancestry chain between the
\fIcommit1\fR
and
\fIcommit2\fR, i\&.e\&. commits that are both descendants of
\fIcommit1\fR, and ancestors of
\fIcommit2\fR\&.
.RE
.sp
A more detailed explanation follows\&.
.sp
Suppose you specified foo as the <paths>\&. We shall call commits that modify foo !TREESAME, and the rest TREESAME\&. (In a diff filtered for foo, they look different and equal, respectively\&.)
.sp
In the following, we will always refer to the same example history to illustrate the differences between simplification settings\&. We assume that you are filtering for a file foo in this commit graph:
.sp
.if n \{\
.RS 4
.\}
.nf
          \&.\-A\-\-\-M\-\-\-N\-\-\-O\-\-\-P
         /     /   /   /   /
        I     B   C   D   E
         \e   /   /   /   /
          `\-\-\-\-\-\-\-\-\-\-\-\-\-\(aq
.fi
.if n \{\
.RE
.\}
.sp
.sp
The horizontal line of history A\(emP is taken to be the first parent of each merge\&. The commits are:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

I
is the initial commit, in which
foo
exists with contents "asdf", and a file
quux
exists with contents "quux"\&. Initial commits are compared to an empty tree, so
I
is !TREESAME\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
In
A,
foo
contains just "foo"\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

B
contains the same change as
A\&. Its merge
M
is trivial and hence TREESAME to all parents\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

C
does not change
foo, but its merge
N
changes it to "foobar", so it is not TREESAME to any parent\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

D
sets
foo
to "baz"\&. Its merge
O
combines the strings from
N
and
D
to "foobarbaz"; i\&.e\&., it is not TREESAME to any parent\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

E
changes
quux
to "xyzzy", and its merge
P
combines the strings to "quux xyzzy"\&. Despite appearing interesting,
P
is TREESAME to all parents\&.
.RE
.sp
\fIrev\-list\fR walks backwards through history, including or excluding commits based on whether \fI\-\-full\-history\fR and/or parent rewriting (via \fI\-\-parents\fR or \fI\-\-children\fR) are used\&. The following settings are available\&.
.PP
Default mode
.RS 4
Commits are included if they are not TREESAME to any parent (though this can be changed, see
\fI\-\-sparse\fR
below)\&. If the commit was a merge, and it was TREESAME to one parent, follow only that parent\&. (Even if there are several TREESAME parents, follow only one of them\&.) Otherwise, follow all parents\&.
.sp
This results in:
.sp
.if n \{\
.RS 4
.\}
.nf
          \&.\-A\-\-\-N\-\-\-O
         /     /   /
        I\-\-\-\-\-\-\-\-\-D
.fi
.if n \{\
.RE
.\}
.sp
Note how the rule to only follow the TREESAME parent, if one is available, removed
B
from consideration entirely\&.
C
was considered via
N, but is TREESAME\&. Root commits are compared to an empty tree, so
I
is !TREESAME\&.
.sp
Parent/child relations are only visible with \-\-parents, but that does not affect the commits selected in default mode, so we have shown the parent lines\&.
.RE
.PP
\-\-full\-history without parent rewriting
.RS 4
This mode differs from the default in one point: always follow all parents of a merge, even if it is TREESAME to one of them\&. Even if more than one side of the merge has commits that are included, this does not imply that the merge itself is! In the example, we get
.sp
.if n \{\
.RS 4
.\}
.nf
        I  A  B  N  D  O
.fi
.if n \{\
.RE
.\}
.sp
P
and
M
were excluded because they are TREESAME to a parent\&.
E,
C
and
B
were all walked, but only
B
was !TREESAME, so the others do not appear\&.
.sp
Note that without parent rewriting, it is not really possible to talk about the parent/child relationships between the commits, so we show them disconnected\&.
.RE
.PP
\-\-full\-history with parent rewriting
.RS 4
Ordinary commits are only included if they are !TREESAME (though this can be changed, see
\fI\-\-sparse\fR
below)\&.
.sp
Merges are always included\&. However, their parent list is rewritten: Along each parent, prune away commits that are not included themselves\&. This results in
.sp
.if n \{\
.RS 4
.\}
.nf
          \&.\-A\-\-\-M\-\-\-N\-\-\-O\-\-\-P
         /     /   /   /   /
        I     B   /   D   /
         \e   /   /   /   /
          `\-\-\-\-\-\-\-\-\-\-\-\-\-\(aq
.fi
.if n \{\
.RE
.\}
.sp
Compare to
\fI\-\-full\-history\fR
without rewriting above\&. Note that
E
was pruned away because it is TREESAME, but the parent list of P was rewritten to contain
E\(aqs parent
I\&. The same happened for
C
and
N\&. Note also that
P
was included despite being TREESAME\&.
.RE
.sp
In addition to the above settings, you can change whether TREESAME affects inclusion:
.PP
\-\-dense
.RS 4
Commits that are walked are included if they are not TREESAME to any parent\&.
.RE
.PP
\-\-sparse
.RS 4
All commits that are walked are included\&.
.sp
Note that without
\fI\-\-full\-history\fR, this still simplifies merges: if one of the parents is TREESAME, we follow only that one, so the other sides of the merge are never walked\&.
.RE
.PP
\-\-simplify\-merges
.RS 4
First, build a history graph in the same way that
\fI\-\-full\-history\fR
with parent rewriting does (see above)\&.
.sp
Then simplify each commit \(oqC` to its replacement
C\(cq
in the final history according to the following rules:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Set \(oqC\(cq` to
C\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Replace each parent \(oqP` of
C\(cq
with its simplification \(oqP\(cq`\&. In the process, drop parents that are ancestors of other parents, and remove duplicates\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If after this parent rewriting, \(oqC\(cq` is a root or merge commit (has zero or >1 parents), a boundary commit, or !TREESAME, it remains\&. Otherwise, it is replaced with its only parent\&.
.RE
.RS 4
The effect of this is best shown by way of comparing to
\fI\-\-full\-history\fR
with parent rewriting\&. The example turns into:
.sp
.if n \{\
.RS 4
.\}
.nf
          \&.\-A\-\-\-M\-\-\-N\-\-\-O
         /     /       /
        I     B       D
         \e   /       /
          `\-\-\-\-\-\-\-\-\-\(aq
.fi
.if n \{\
.RE
.\}
.sp
Note the major differences in
N
and
P
over
\fI\-\-full\-history\fR:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

N\(aqs parent list had
I
removed, because it is an ancestor of the other parent
M\&. Still,
N
remained because it is !TREESAME\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

P\(aqs parent list similarly had
I
removed\&.
P
was then removed completely, because it had one parent and is TREESAME\&.
.RE
.RE
.sp
Finally, there is a fifth simplification mode available:
.PP
\-\-ancestry\-path
.RS 4
Limit the displayed commits to those directly on the ancestry chain between the "from" and "to" commits in the given commit range\&. I\&.e\&. only display commits that are ancestor of the "to" commit, and descendants of the "from" commit\&.
.sp
As an example use case, consider the following commit history:
.sp
.if n \{\
.RS 4
.\}
.nf
            D\-\-\-E\-\-\-\-\-\-\-F
           /     \e       \e
          B\-\-\-C\-\-\-G\-\-\-H\-\-\-I\-\-\-J
         /                     \e
        A\-\-\-\-\-\-\-K\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-L\-\-M
.fi
.if n \{\
.RE
.\}
.sp
A regular
\fID\&.\&.M\fR
computes the set of commits that are ancestors of
M, but excludes the ones that are ancestors of
D\&. This is useful to see what happened to the history leading to
M
since
D, in the sense that "what does
M
have that did not exist in
D"\&. The result in this example would be all the commits, except
A
and
B
(and
D
itself, of course)\&.
.sp
When we want to find out what commits in
M
are contaminated with the bug introduced by
D
and need fixing, however, we might want to view only the subset of
\fID\&.\&.M\fR
that are actually descendants of
D, i\&.e\&. excluding
C
and
K\&. This is exactly what the
\fI\-\-ancestry\-path\fR
option does\&. Applied to the
\fID\&.\&.M\fR
range, it results in:
.sp
.if n \{\
.RS 4
.\}
.nf
                E\-\-\-\-\-\-\-F
                 \e       \e
                  G\-\-\-H\-\-\-I\-\-\-J
                               \e
                                L\-\-M
.fi
.if n \{\
.RE
.\}
.sp
.RE
.sp
The \fI\-\-simplify\-by\-decoration\fR option allows you to view only the big picture of the topology of the history, by omitting commits that are not referenced by tags\&. Commits are marked as !TREESAME (in other words, kept after history simplification rules described above) if (1) they are referenced by tags, or (2) they change the contents of the paths given on the command line\&. All other commits are marked as TREESAME (subject to be simplified away)\&.
.SS "Bisection Helpers"
.PP
\-\-bisect
.RS 4
Limit output to the one commit object which is roughly halfway between included and excluded commits\&. Note that the bad bisection ref
refs/bisect/bad
is added to the included commits (if it exists) and the good bisection refs
refs/bisect/good\-*
are added to the excluded commits (if they exist)\&. Thus, supposing there are no refs in
refs/bisect/, if
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
        $ git rev\-list \-\-bisect foo ^bar ^baz
.fi
.if n \{\
.RE
.\}
.sp
.sp
outputs \fImidpoint\fR, the output of the two commands
.sp
.if n \{\
.RS 4
.\}
.nf
        $ git rev\-list foo ^midpoint
        $ git rev\-list midpoint ^bar ^baz
.fi
.if n \{\
.RE
.\}
.sp
.sp
would be of roughly the same length\&. Finding the change which introduces a regression is thus reduced to a binary search: repeatedly generate and test new \(aqmidpoint\(cqs until the commit chain is of length one\&.
.PP
\-\-bisect\-vars
.RS 4
This calculates the same as
\-\-bisect, except that refs in
refs/bisect/
are not used, and except that this outputs text ready to be eval\(cqed by the shell\&. These lines will assign the name of the midpoint revision to the variable
bisect_rev, and the expected number of commits to be tested after
bisect_rev
is tested to
bisect_nr, the expected number of commits to be tested if
bisect_rev
turns out to be good to
bisect_good, the expected number of commits to be tested if
bisect_rev
turns out to be bad to
bisect_bad, and the number of commits we are bisecting right now to
bisect_all\&.
.RE
.PP
\-\-bisect\-all
.RS 4
This outputs all the commit objects between the included and excluded commits, ordered by their distance to the included and excluded commits\&. Refs in
refs/bisect/
are not used\&. The farthest from them is displayed first\&. (This is the only one displayed by
\-\-bisect\&.)
.sp
This is useful because it makes it easy to choose a good commit to test when you want to avoid to test some of them for some reason (they may not compile for example)\&.
.sp
This option can be used along with
\-\-bisect\-vars, in this case, after all the sorted commit objects, there will be the same text as if
\-\-bisect\-vars
had been used alone\&.
.RE
.SS "Commit Ordering"
.sp
By default, the commits are shown in reverse chronological order\&.
.PP
\-\-topo\-order
.RS 4
This option makes them appear in topological order (i\&.e\&. descendant commits are shown before their parents)\&.
.RE
.PP
\-\-date\-order
.RS 4
This option is similar to
\fI\-\-topo\-order\fR
in the sense that no parent comes before all of its children, but otherwise things are still ordered in the commit timestamp order\&.
.RE
.PP
\-\-reverse
.RS 4
Output the commits in reverse order\&. Cannot be combined with
\fI\-\-walk\-reflogs\fR\&.
.RE
.SS "Object Traversal"
.sp
These options are mostly targeted for packing of git repositories\&.
.PP
\-\-objects
.RS 4
Print the object IDs of any object referenced by the listed commits\&.
\fI\-\-objects foo ^bar\fR
thus means "send me all object IDs which I need to download if I have the commit object
\fIbar\fR, but not
\fIfoo\fR"\&.
.RE
.PP
\-\-objects\-edge
.RS 4
Similar to
\fI\-\-objects\fR, but also print the IDs of excluded commits prefixed with a "\-" character\&. This is used by
\fBgit-pack-objects\fR(1)
to build "thin" pack, which records objects in deltified form based on objects contained in these excluded commits to reduce network traffic\&.
.RE
.PP
\-\-unpacked
.RS 4
Only useful with
\fI\-\-objects\fR; print the object IDs that are not in packs\&.
.RE
.PP
\-\-no\-walk
.RS 4
Only show the given revs, but do not traverse their ancestors\&.
.RE
.PP
\-\-do\-walk
.RS 4
Overrides a previous \-\-no\-walk\&.
.RE
.SS "Commit Formatting"
.sp
Using these options, \fBgit-rev-list\fR(1) will act similar to the more specialized family of commit log tools: \fBgit-log\fR(1), \fBgit-show\fR(1), and \fBgit-whatchanged\fR(1)
.PP
\-\-pretty[=<format>], \-\-format=<format>
.RS 4
Pretty\-print the contents of the commit logs in a given format, where
\fI<format>\fR
can be one of
\fIoneline\fR,
\fIshort\fR,
\fImedium\fR,
\fIfull\fR,
\fIfuller\fR,
\fIemail\fR,
\fIraw\fR
and
\fIformat:<string>\fR\&. See the "PRETTY FORMATS" section for some additional details for each format\&. When omitted, the format defaults to
\fImedium\fR\&.
.sp
Note: you can specify the default pretty format in the repository configuration (see
\fBgit-config\fR(1))\&.
.RE
.PP
\-\-abbrev\-commit
.RS 4
Instead of showing the full 40\-byte hexadecimal commit object name, show only a partial prefix\&. Non default number of digits can be specified with "\-\-abbrev=<n>" (which also modifies diff output, if it is displayed)\&.
.sp
This should make "\-\-pretty=oneline" a whole lot more readable for people using 80\-column terminals\&.
.RE
.PP
\-\-oneline
.RS 4
This is a shorthand for "\-\-pretty=oneline \-\-abbrev\-commit" used together\&.
.RE
.PP
\-\-encoding[=<encoding>]
.RS 4
The commit objects record the encoding used for the log message in their encoding header; this option can be used to tell the command to re\-code the commit log message in the encoding preferred by the user\&. For non plumbing commands this defaults to UTF\-8\&.
.RE
.PP
\-\-no\-notes, \-\-show\-notes[=<ref>]
.RS 4
Show the notes (see
\fBgit-notes\fR(1)) that annotate the commit, when showing the commit log message\&. This is the default for
git log,
git show
and
git whatchanged
commands when there is no
\-\-pretty,
\-\-format
nor
\-\-oneline
option is given on the command line\&.
.sp
With an optional argument, add this ref to the list of notes\&. The ref is taken to be in
refs/notes/
if it is not qualified\&.
.RE
.PP
\-\-[no\-]standard\-notes
.RS 4
Enable or disable populating the notes ref list from the
\fIcore\&.notesRef\fR
and
\fInotes\&.displayRef\fR
variables (or corresponding environment overrides)\&. Enabled by default\&. See
\fBgit-config\fR(1)\&.
.RE
.PP
\-\-relative\-date
.RS 4
Synonym for
\-\-date=relative\&.
.RE
.PP
\-\-date=(relative|local|default|iso|rfc|short|raw)
.RS 4
Only takes effect for dates shown in human\-readable format, such as when using "\-\-pretty"\&.
log\&.date
config variable sets a default value for log command\(cqs \-\-date option\&.
.sp
\-\-date=relative
shows dates relative to the current time, e\&.g\&. "2 hours ago"\&.
.sp
\-\-date=local
shows timestamps in user\(cqs local timezone\&.
.sp
\-\-date=iso
(or
\-\-date=iso8601) shows timestamps in ISO 8601 format\&.
.sp
\-\-date=rfc
(or
\-\-date=rfc2822) shows timestamps in RFC 2822 format, often found in E\-mail messages\&.
.sp
\-\-date=short
shows only date but not time, in
YYYY\-MM\-DD
format\&.
.sp
\-\-date=raw
shows the date in the internal raw git format
%s %z
format\&.
.sp
\-\-date=default
shows timestamps in the original timezone (either committer\(cqs or author\(cqs)\&.
.RE
.PP
\-\-header
.RS 4
Print the contents of the commit in raw\-format; each record is separated with a NUL character\&.
.RE
.PP
\-\-parents
.RS 4
Print also the parents of the commit (in the form "commit parent\&...")\&. Also enables parent rewriting, see
\fIHistory Simplification\fR
below\&.
.RE
.PP
\-\-children
.RS 4
Print also the children of the commit (in the form "commit child\&...")\&. Also enables parent rewriting, see
\fIHistory Simplification\fR
below\&.
.RE
.PP
\-\-timestamp
.RS 4
Print the raw commit timestamp\&.
.RE
.PP
\-\-left\-right
.RS 4
Mark which side of a symmetric diff a commit is reachable from\&. Commits from the left side are prefixed with
<
and those from the right with
>\&. If combined with
\-\-boundary, those commits are prefixed with
\-\&.
.sp
For example, if you have this topology:
.sp
.if n \{\
.RS 4
.\}
.nf
             y\-\-\-b\-\-\-b  branch B
            / \e /
           /   \&.
          /   / \e
         o\-\-\-x\-\-\-a\-\-\-a  branch A
.fi
.if n \{\
.RE
.\}
.sp
you would get an output like this:
.sp
.if n \{\
.RS 4
.\}
.nf
        $ git rev\-list \-\-left\-right \-\-boundary \-\-pretty=oneline A\&.\&.\&.B

        >bbbbbbb\&.\&.\&. 3rd on b
        >bbbbbbb\&.\&.\&. 2nd on b
        <aaaaaaa\&.\&.\&. 3rd on a
        <aaaaaaa\&.\&.\&. 2nd on a
        \-yyyyyyy\&.\&.\&. 1st on b
        \-xxxxxxx\&.\&.\&. 1st on a
.fi
.if n \{\
.RE
.\}
.sp
.RE
.PP
\-\-graph
.RS 4
Draw a text\-based graphical representation of the commit history on the left hand side of the output\&. This may cause extra lines to be printed in between commits, in order for the graph history to be drawn properly\&.
.sp
This enables parent rewriting, see
\fIHistory Simplification\fR
below\&.
.sp
This implies the
\fI\-\-topo\-order\fR
option by default, but the
\fI\-\-date\-order\fR
option may also be specified\&.
.RE
.PP
\-\-count
.RS 4
Print a number stating how many commits would have been listed, and suppress all other output\&. When used together with
\fI\-\-left\-right\fR, instead print the counts for left and right commits, separated by a tab\&.
.RE
.SH "PRETTY FORMATS"
.sp
If the commit is a merge, and if the pretty\-format is not \fIoneline\fR, \fIemail\fR or \fIraw\fR, an additional line is inserted before the \fIAuthor:\fR line\&. This line begins with "Merge: " and the sha1s of ancestral commits are printed, separated by spaces\&. Note that the listed commits may not necessarily be the list of the \fBdirect\fR parent commits if you have limited your view of history: for example, if you are only interested in changes related to a certain directory or file\&.
.sp
There are several built\-in formats, and you can define additional formats by setting a pretty\&.<name> config option to either another format name, or a \fIformat:\fR string, as described below (see \fBgit-config\fR(1))\&. Here are the details of the built\-in formats:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fIoneline\fR
.sp
.if n \{\
.RS 4
.\}
.nf
<sha1> <title line>
.fi
.if n \{\
.RE
.\}
.sp
This is designed to be as compact as possible\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fIshort\fR
.sp
.if n \{\
.RS 4
.\}
.nf
commit <sha1>
Author: <author>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<title line>
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fImedium\fR
.sp
.if n \{\
.RS 4
.\}
.nf
commit <sha1>
Author: <author>
Date:   <author date>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<title line>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<full commit message>
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fIfull\fR
.sp
.if n \{\
.RS 4
.\}
.nf
commit <sha1>
Author: <author>
Commit: <committer>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<title line>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<full commit message>
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fIfuller\fR
.sp
.if n \{\
.RS 4
.\}
.nf
commit <sha1>
Author:     <author>
AuthorDate: <author date>
Commit:     <committer>
CommitDate: <committer date>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<title line>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<full commit message>
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fIemail\fR
.sp
.if n \{\
.RS 4
.\}
.nf
From <sha1> <date>
From: <author>
Date: <author date>
Subject: [PATCH] <title line>
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
<full commit message>
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fIraw\fR
.sp
The
\fIraw\fR
format shows the entire commit exactly as stored in the commit object\&. Notably, the SHA1s are displayed in full, regardless of whether \-\-abbrev or \-\-no\-abbrev are used, and
\fIparents\fR
information show the true parent commits, without taking grafts nor history simplification into account\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fIformat:<string>\fR
.sp
The
\fIformat:<string>\fR
format allows you to specify which information you want to show\&. It works a little bit like printf format, with the notable exception that you get a newline with
\fI%n\fR
instead of
\fI\en\fR\&.
.sp
E\&.g,
\fIformat:"The author of %h was %an, %ar%nThe title was >>%s<<%n"\fR
would show something like this:
.sp
.if n \{\
.RS 4
.\}
.nf
The author of fe6e0ee was Junio C Hamano, 23 hours ago
The title was >>t4119: test autocomputing \-p<n> for traditional diff input\&.<<
.fi
.if n \{\
.RE
.\}
.sp
The placeholders are:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%H\fR: commit hash
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%h\fR: abbreviated commit hash
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%T\fR: tree hash
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%t\fR: abbreviated tree hash
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%P\fR: parent hashes
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%p\fR: abbreviated parent hashes
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%an\fR: author name
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%aN\fR: author name (respecting \&.mailmap, see
\fBgit-shortlog\fR(1)
or
\fBgit-blame\fR(1))
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%ae\fR: author email
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%aE\fR: author email (respecting \&.mailmap, see
\fBgit-shortlog\fR(1)
or
\fBgit-blame\fR(1))
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%ad\fR: author date (format respects \-\-date= option)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%aD\fR: author date, RFC2822 style
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%ar\fR: author date, relative
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%at\fR: author date, UNIX timestamp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%ai\fR: author date, ISO 8601 format
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%cn\fR: committer name
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%cN\fR: committer name (respecting \&.mailmap, see
\fBgit-shortlog\fR(1)
or
\fBgit-blame\fR(1))
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%ce\fR: committer email
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%cE\fR: committer email (respecting \&.mailmap, see
\fBgit-shortlog\fR(1)
or
\fBgit-blame\fR(1))
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%cd\fR: committer date
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%cD\fR: committer date, RFC2822 style
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%cr\fR: committer date, relative
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%ct\fR: committer date, UNIX timestamp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%ci\fR: committer date, ISO 8601 format
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%d\fR: ref names, like the \-\-decorate option of
\fBgit-log\fR(1)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%e\fR: encoding
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%s\fR: subject
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%f\fR: sanitized subject line, suitable for a filename
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%b\fR: body
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%B\fR: raw body (unwrapped subject and body)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%N\fR: commit notes
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%gD\fR: reflog selector, e\&.g\&.,
refs/stash@{1}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%gd\fR: shortened reflog selector, e\&.g\&.,
stash@{1}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%gs\fR: reflog subject
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%Cred\fR: switch color to red
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%Cgreen\fR: switch color to green
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%Cblue\fR: switch color to blue
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%Creset\fR: reset color
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%C(\&...)\fR: color specification, as described in color\&.branch\&.* config option
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%m\fR: left, right or boundary mark
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%n\fR: newline
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%%\fR: a raw
\fI%\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%x00\fR: print a byte from a hex code
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fI%w([<w>[,<i1>[,<i2>]]])\fR: switch line wrapping, like the \-w option of
\fBgit-shortlog\fR(1)\&.
.RE
.RE
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.sp
Some placeholders may depend on other options given to the revision traversal engine\&. For example, the %g* reflog options will insert an empty string unless we are traversing reflog entries (e\&.g\&., by git log \-g)\&. The %d placeholder will use the "short" decoration format if \-\-decorate was not already provided on the command line\&.
.sp .5v
.RE
.sp
If you add a + (plus sign) after \fI%\fR of a placeholder, a line\-feed is inserted immediately before the expansion if and only if the placeholder expands to a non\-empty string\&.
.sp
If you add a \- (minus sign) after \fI%\fR of a placeholder, line\-feeds that immediately precede the expansion are deleted if and only if the placeholder expands to an empty string\&.
.sp
If you add a ` ` (space) after \fI%\fR of a placeholder, a space is inserted immediately before the expansion if and only if the placeholder expands to a non\-empty string\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}

\fItformat:\fR
.sp
The
\fItformat:\fR
format works exactly like
\fIformat:\fR, except that it provides "terminator" semantics instead of "separator" semantics\&. In other words, each commit has the message terminator character (usually a newline) appended, rather than a separator placed between entries\&. This means that the final entry of a single\-line format will be properly terminated with a new line, just as the "oneline" format does\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ git log \-2 \-\-pretty=format:%h 4da45bef \e
  | perl \-pe \(aq$_ \&.= " \-\- NO NEWLINE\en" unless /\en/\(aq
4da45be
7134973 \-\- NO NEWLINE

$ git log \-2 \-\-pretty=tformat:%h 4da45bef \e
  | perl \-pe \(aq$_ \&.= " \-\- NO NEWLINE\en" unless /\en/\(aq
4da45be
7134973
.fi
.if n \{\
.RE
.\}
.sp
In addition, any unrecognized string that has a
%
in it is interpreted as if it has
tformat:
in front of it\&. For example, these two are equivalent:
.sp
.if n \{\
.RS 4
.\}
.nf
$ git log \-2 \-\-pretty=tformat:%h 4da45bef
$ git log \-2 \-\-pretty=%h 4da45bef
.fi
.if n \{\
.RE
.\}
.sp
.RE
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite