<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<article lang="en" id="git-rev-list(1)">
<articleinfo>
    <title>git-rev-list(1)</title>
        <indexterm>
                <primary>git-rev-list(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-rev-list - Lists commit objects in reverse chronological order</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<blockquote>
<literallayout><emphasis>git-rev-list</emphasis> [ --max-count=number ]
             [ --skip=number ]
             [ --max-age=timestamp ]
             [ --min-age=timestamp ]
             [ --sparse ]
             [ --no-merges ]
             [ --first-parent ]
             [ --remove-empty ]
             [ --full-history ]
             [ --not ]
             [ --all ]
             [ --branches ]
             [ --tags ]
             [ --remotes ]
             [ --stdin ]
             [ --quiet ]
             [ --topo-order ]
             [ --parents ]
             [ --timestamp ]
             [ --left-right ]
             [ --cherry-pick ]
             [ --encoding[=&lt;encoding&gt;] ]
             [ --(author|committer|grep)=&lt;pattern&gt; ]
             [ --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 ]
             &lt;commit&gt;&#8230; [ -- &lt;paths&gt;&#8230; ]</literallayout>
</blockquote>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>Lists commit objects in reverse chronological order starting at the
given commit(s), taking ancestry relationship into account.  This is
useful to produce human-readable log output.</simpara>
<simpara>Commits which are stated with a preceding <emphasis>&#94;</emphasis> cause listing to
stop at that point. Their parents are implied. Thus the following
command:</simpara>
<literallayout>        $ git rev-list foo bar ^baz</literallayout>
<simpara>means "list all the commits which are included in <emphasis>foo</emphasis> and <emphasis>bar</emphasis>, but
not in <emphasis>baz</emphasis>".</simpara>
<simpara>A special notation "<emphasis>&lt;commit1&gt;</emphasis>..<emphasis>&lt;commit2&gt;</emphasis>" can be used as a
short-hand for "&#94;<emphasis>&lt;commit1&gt;</emphasis> <emphasis>&lt;commit2&gt;</emphasis>". For example, either of
the following may be used interchangeably:</simpara>
<literallayout>        $ git rev-list origin..HEAD
        $ git rev-list HEAD ^origin</literallayout>
<simpara>Another special notation is "<emphasis>&lt;commit1&gt;</emphasis>&#8230;<emphasis>&lt;commit2&gt;</emphasis>" which is useful
for merges.  The resulting set of commits is the symmetric difference
between the two operands.  The following two commands are equivalent:</simpara>
<literallayout>        $ git rev-list A B --not $(git merge-base --all A B)
        $ git rev-list A...B</literallayout>
<simpara><emphasis>git-rev-list</emphasis> is a very essential git program, 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 <emphasis>git-bisect</emphasis> and
<emphasis>git-repack</emphasis>.</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<simplesect id="_commit_formatting">
<title>Commit Formatting</title>
<simpara>Using these options, <xref linkend="git-rev-list(1)"/> will act similar to the
more specialized family of commit log tools: <xref linkend="git-log(1)"/>,
<xref linkend="git-show(1)"/>, and <xref linkend="git-whatchanged(1)"/></simpara>
<variablelist>
<varlistentry>
<term>
--pretty[=<emphasis>&lt;format&gt;</emphasis>]
</term>
<listitem>
<simpara>
        Pretty-print the contents of the commit logs in a given format,
        where <emphasis>&lt;format&gt;</emphasis> can be one of <emphasis>oneline</emphasis>, <emphasis>short</emphasis>, <emphasis>medium</emphasis>,
        <emphasis>full</emphasis>, <emphasis>fuller</emphasis>, <emphasis>email</emphasis>, <emphasis>raw</emphasis> and <emphasis>format:&lt;string&gt;</emphasis>.
        When omitted, the format defaults to <emphasis>medium</emphasis>.
</simpara>
<simpara>Note: you can specify the default pretty format in the repository
configuration (see <xref linkend="git-config(1)"/>).</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--abbrev-commit
</term>
<listitem>
<simpara>
        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=&lt;n&gt;" (which also modifies
        diff output, if it is displayed).
</simpara>
<simpara>This should make "--pretty=oneline" a whole lot more readable for
people using 80-column terminals.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--encoding[=&lt;encoding&gt;]
</term>
<listitem>
<simpara>
        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.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--relative-date
</term>
<listitem>
<simpara>
        Synonym for <literal>--date=relative</literal>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--date={relative,local,default,iso,rfc,short}
</term>
<listitem>
<simpara>
        Only takes effect for dates shown in human-readable format, such
        as when using "--pretty". <literal>log.date</literal> config variable sets a default
        value for log command&#8217;s --date option.
</simpara>
<simpara><literal>--date=relative</literal> shows dates relative to the current time,
e.g. "2 hours ago".</simpara>
<simpara><literal>--date=local</literal> shows timestamps in user&#8217;s local timezone.</simpara>
<simpara><literal>--date=iso</literal> (or <literal>--date=iso8601</literal>) shows timestamps in ISO 8601 format.</simpara>
<simpara><literal>--date=rfc</literal> (or <literal>--date=rfc2822</literal>) shows timestamps in RFC 2822
format, often found in E-mail messages.</simpara>
<simpara><literal>--date=short</literal> shows only date but not time, in <literal>YYYY-MM-DD</literal> format.</simpara>
<simpara><literal>--date=default</literal> shows timestamps in the original timezone
(either committer&#8217;s or author&#8217;s).</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--header
</term>
<listitem>
<simpara>
        Print the contents of the commit in raw-format; each record is
        separated with a NUL character.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--parents
</term>
<listitem>
<simpara>
        Print the parents of the commit.  Also enables parent
        rewriting, see <emphasis>History Simplification</emphasis> below.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--children
</term>
<listitem>
<simpara>
        Print the children of the commit.  Also enables parent
        rewriting, see <emphasis>History Simplification</emphasis> below.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--timestamp
</term>
<listitem>
<simpara>
        Print the raw commit timestamp.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--left-right
</term>
<listitem>
<simpara>
        Mark which side of a symmetric diff a commit is reachable from.
        Commits from the left side are prefixed with <literal>&lt;</literal> and those from
        the right with <literal>&gt;</literal>.  If combined with <literal>--boundary</literal>, those
        commits are prefixed with <literal>-</literal>.
</simpara>
<simpara>For example, if you have this topology:</simpara>
<literallayout>             y---b---b  branch B
            / \ /
           /   .
          /   / \
         o---x---a---a  branch A</literallayout>
<simpara>you would get an output like this:</simpara>
<literallayout>        $ git rev-list --left-right --boundary --pretty=oneline A...B

        &gt;bbbbbbb... 3rd on b
        &gt;bbbbbbb... 2nd on b
        &lt;aaaaaaa... 3rd on a
        &lt;aaaaaaa... 2nd on a
        -yyyyyyy... 1st on b
        -xxxxxxx... 1st on a</literallayout>
</listitem>
</varlistentry>
<varlistentry>
<term>
--graph
</term>
<listitem>
<simpara>
        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.
</simpara>
<simpara>This implies the <emphasis>--topo-order</emphasis> option by default, but the
<emphasis>--date-order</emphasis> option may also be specified.</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_commit_limiting">
<title>Commit Limiting</title>
<simpara>Besides specifying a range of commits that should be listed using the
special notations explained in the description, additional commit
limiting may be applied.</simpara>
<variablelist>
<varlistentry>
<term>
-n <emphasis>number</emphasis>
</term>
<term>
--max-count=<emphasis>number</emphasis>
</term>
<listitem>
<simpara>
        Limit the number of commits output.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--skip=<emphasis>number</emphasis>
</term>
<listitem>
<simpara>
        Skip <emphasis>number</emphasis> commits before starting to show the commit output.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--since=<emphasis>date</emphasis>
</term>
<term>
--after=<emphasis>date</emphasis>
</term>
<listitem>
<simpara>
        Show commits more recent than a specific date.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--until=<emphasis>date</emphasis>
</term>
<term>
--before=<emphasis>date</emphasis>
</term>
<listitem>
<simpara>
        Show commits older than a specific date.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--max-age=<emphasis>timestamp</emphasis>
</term>
<term>
--min-age=<emphasis>timestamp</emphasis>
</term>
<listitem>
<simpara>
        Limit the commits output to specified time range.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--author=<emphasis>pattern</emphasis>
</term>
<term>
--committer=<emphasis>pattern</emphasis>
</term>
<listitem>
<simpara>
        Limit the commits output to ones with author/committer
        header lines that match the specified pattern (regular expression).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--grep=<emphasis>pattern</emphasis>
</term>
<listitem>
<simpara>
        Limit the commits output to ones with log message that
        matches the specified pattern (regular expression).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--all-match
</term>
<listitem>
<simpara>
        Limit the commits output to ones that match all given --grep,
        --author and --committer instead of ones that match at least one.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-i
</term>
<term>
--regexp-ignore-case
</term>
<listitem>
<simpara>
        Match the regexp limiting patterns without regard to letters case.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-E
</term>
<term>
--extended-regexp
</term>
<listitem>
<simpara>
        Consider the limiting patterns to be extended regular expressions
        instead of the default basic regular expressions.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-F
</term>
<term>
--fixed-strings
</term>
<listitem>
<simpara>
        Consider the limiting patterns to be fixed strings (don&#8217;t interpret
        pattern as a regular expression).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--remove-empty
</term>
<listitem>
<simpara>
        Stop when a given path disappears from the tree.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-merges
</term>
<listitem>
<simpara>
        Do not print commits with more than one parent.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--first-parent
</term>
<listitem>
<simpara>
        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.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--not
</term>
<listitem>
<simpara>
        Reverses the meaning of the <emphasis>&#94;</emphasis> prefix (or lack thereof)
        for all following revision specifiers, up to the next <emphasis>--not</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--all
</term>
<listitem>
<simpara>
        Pretend as if all the refs in <literal>$GIT_DIR/refs/</literal> are listed on the
        command line as <emphasis>&lt;commit&gt;</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--branches
</term>
<listitem>
<simpara>
        Pretend as if all the refs in <literal>$GIT_DIR/refs/heads</literal> are listed
        on the command line as <emphasis>&lt;commit&gt;</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--tags
</term>
<listitem>
<simpara>
        Pretend as if all the refs in <literal>$GIT_DIR/refs/tags</literal> are listed
        on the command line as <emphasis>&lt;commit&gt;</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--remotes
</term>
<listitem>
<simpara>
        Pretend as if all the refs in <literal>$GIT_DIR/refs/remotes</literal> are listed
        on the command line as <emphasis>&lt;commit&gt;</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--stdin
</term>
<listitem>
<simpara>
        In addition to the <emphasis>&lt;commit&gt;</emphasis> listed on the command
        line, read them from the standard input.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--quiet
</term>
<listitem>
<simpara>
        Don&#8217;t 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.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--cherry-pick
</term>
<listitem>
<simpara>
        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.
</simpara>
<simpara>For example, if you have two branches, <literal>A</literal> and <literal>B</literal>, a usual way
to list all commits on only one side of them is with
<literal>--left-right</literal>, like the example above in the description of
that 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.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-g
</term>
<term>
--walk-reflogs
</term>
<listitem>
<simpara>
        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, <emphasis>&#94;commit</emphasis>, <emphasis>commit1..commit2</emphasis>,
        nor <emphasis>commit1&#8230;commit2</emphasis> notations cannot be used).
</simpara>
<simpara>With <emphasis>--pretty</emphasis> format other than oneline (for obvious reasons),
this causes the output to have two extra lines of information
taken from the reflog.  By default, <emphasis>commit@{Nth}</emphasis> notation is
used in the output.  When the starting commit is specified as
<emphasis>commit@{now}</emphasis>, output also uses <emphasis>commit@{timestamp}</emphasis> notation
instead.  Under <emphasis>--pretty=oneline</emphasis>, the commit message is
prefixed with this information on the same line.
This option cannot be combined with <emphasis>--reverse</emphasis>.
See also <xref linkend="git-reflog(1)"/>.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--merge
</term>
<listitem>
<simpara>
        After a failed merge, show refs that touch files having a
        conflict and don&#8217;t exist on all heads to merge.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--boundary
</term>
<listitem>
<simpara>
        Output uninteresting commits at the boundary, which are usually
        not shown.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_history_simplification">
<title>History Simplification</title>
<simpara>Sometimes you are only interested in parts of the history, for example the
commits modifying a particular &lt;path&gt;. But there are two parts of
<emphasis>History Simplification</emphasis>, one part is selecting the commits and the other
is how to do it, as there are various strategies to simplify the history.</simpara>
<simpara>The following options select the commits to be shown:</simpara>
<variablelist>
<varlistentry>
<term>
&lt;paths&gt;
</term>
<listitem>
<simpara>
        Commits modifying the given &lt;paths&gt; are selected.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--simplify-by-decoration
</term>
<listitem>
<simpara>
        Commits that are referred by some branch or tag are selected.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>Note that extra commits can be shown to give a meaningful history.</simpara>
<simpara>The following options affect the way the simplification is performed:</simpara>
<variablelist>
<varlistentry>
<term>
Default mode
</term>
<listitem>
<simpara>
        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)
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--full-history
</term>
<listitem>
<simpara>
        As the default mode but does not prune some history.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--dense
</term>
<listitem>
<simpara>
        Only the selected commits are shown, plus some to have a
        meaningful history.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--sparse
</term>
<listitem>
<simpara>
        All commits in the simplified history are shown.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--simplify-merges
</term>
<listitem>
<simpara>
        Additional option to <emphasis>--full-history</emphasis> to remove some needless
        merges from the resulting history, as there are no selected
        commits contributing to this merge.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>A more detailed explanation follows.</simpara>
<simpara>Suppose you specified <literal>foo</literal> as the &lt;paths&gt;.  We shall call commits
that modify <literal>foo</literal> !TREESAME, and the rest TREESAME.  (In a diff
filtered for <literal>foo</literal>, they look different and equal, respectively.)</simpara>
<simpara>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 <literal>foo</literal> in this commit graph:</simpara>
<literallayout>          .-A---M---N---O---P
         /     /   /   /   /
        I     B   C   D   E
         \   /   /   /   /
          `-------------'</literallayout>
<simpara>The horizontal line of history A&#8212;P is taken to be the first parent of
each merge.  The commits are:</simpara>
<itemizedlist>
<listitem>
<simpara>
<literal>I</literal> is the initial commit, in which <literal>foo</literal> exists with contents
  "asdf", and a file <literal>quux</literal> exists with contents "quux".  Initial
  commits are compared to an empty tree, so <literal>I</literal> is !TREESAME.
</simpara>
</listitem>
<listitem>
<simpara>
In <literal>A</literal>, <literal>foo</literal> contains just "foo".
</simpara>
</listitem>
<listitem>
<simpara>
<literal>B</literal> contains the same change as <literal>A</literal>.  Its merge <literal>M</literal> is trivial and
  hence TREESAME to all parents.
</simpara>
</listitem>
<listitem>
<simpara>
<literal>C</literal> does not change <literal>foo</literal>, but its merge <literal>N</literal> changes it to "foobar",
  so it is not TREESAME to any parent.
</simpara>
</listitem>
<listitem>
<simpara>
<literal>D</literal> sets <literal>foo</literal> to "baz".  Its merge <literal>O</literal> combines the strings from
  <literal>N</literal> and <literal>D</literal> to "foobarbaz"; i.e., it is not TREESAME to any parent.
</simpara>
</listitem>
<listitem>
<simpara>
<literal>E</literal> changes <literal>quux</literal> to "xyzzy", and its merge <literal>P</literal> combines the
  strings to "quux xyzzy".  Despite appearing interesting, <literal>P</literal> is
  TREESAME to all parents.
</simpara>
</listitem>
</itemizedlist>
<simpara><emphasis>rev-list</emphasis> walks backwards through history, including or excluding
commits based on whether <emphasis>--full-history</emphasis> and/or parent rewriting
(via <emphasis>--parents</emphasis> or <emphasis>--children</emphasis>) are used.  The following settings
are available.</simpara>
<variablelist>
<varlistentry>
<term>
Default mode
</term>
<listitem>
<simpara>
        Commits are included if they are not TREESAME to any parent
        (though this can be changed, see <emphasis>--sparse</emphasis> 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.
</simpara>
<simpara>This results in:</simpara>
<literallayout>          .-A---N---O
         /         /
        I---------D</literallayout>
<simpara>Note how the rule to only follow the TREESAME parent, if one is
available, removed <literal>B</literal> from consideration entirely.  <literal>C</literal> was
considered via <literal>N</literal>, but is TREESAME.  Root commits are compared to an
empty tree, so <literal>I</literal> is !TREESAME.</simpara>
<simpara>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.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--full-history without parent rewriting
</term>
<listitem>
<simpara>
        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
</simpara>
<literallayout>        I  A  B  N  D  O</literallayout>
<simpara><literal>P</literal> and <literal>M</literal> were excluded because they are TREESAME to a parent.  <literal>E</literal>,
<literal>C</literal> and <literal>B</literal> were all walked, but only <literal>B</literal> was !TREESAME, so the others
do not appear.</simpara>
<simpara>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.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--full-history with parent rewriting
</term>
<listitem>
<simpara>
        Ordinary commits are only included if they are !TREESAME
        (though this can be changed, see <emphasis>--sparse</emphasis> below).
</simpara>
<simpara>Merges are always included.  However, their parent list is rewritten:
Along each parent, prune away commits that are not included
themselves.  This results in</simpara>
<literallayout>          .-A---M---N---O---P
         /     /   /   /   /
        I     B   /   D   /
         \   /   /   /   /
          `-------------'</literallayout>
<simpara>Compare to <emphasis>--full-history</emphasis> without rewriting above.  Note that <literal>E</literal>
was pruned away because it is TREESAME, but the parent list of P was
rewritten to contain <literal>E</literal>'s parent <literal>I</literal>.  The same happened for <literal>C</literal> and
<literal>N</literal>.  Note also that <literal>P</literal> was included despite being TREESAME.</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>In addition to the above settings, you can change whether TREESAME
affects inclusion:</simpara>
<variablelist>
<varlistentry>
<term>
--dense
</term>
<listitem>
<simpara>
        Commits that are walked are included if they are not TREESAME
        to any parent.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--sparse
</term>
<listitem>
<simpara>
        All commits that are walked are included.
</simpara>
<simpara>Note that without <emphasis>--full-history</emphasis>, 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.</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>Finally, there is a fourth simplification mode available:</simpara>
<variablelist>
<varlistentry>
<term>
--simplify-merges
</term>
<listitem>
<simpara>
        First, build a history graph in the same way that
        <emphasis>--full-history</emphasis> with parent rewriting does (see above).
</simpara>
<simpara>Then simplify each commit &#8216;C` to its replacement <literal>C&#8217;</literal> in the final
history according to the following rules:</simpara>
<itemizedlist>
<listitem>
<simpara>
Set &#8216;C&#8217;<literal> to `C</literal>.
</simpara>
</listitem>
<listitem>
<simpara>
Replace each parent &#8216;P` of <literal>C&#8217;</literal> with its simplification &#8216;P&#8217;`.  In
  the process, drop parents that are ancestors of other parents, and
  remove duplicates.
</simpara>
</listitem>
<listitem>
<simpara>
If after this parent rewriting, &#8216;C&#8217;` is a root or merge commit (has
  zero or &gt;1 parents), a boundary commit, or !TREESAME, it remains.
  Otherwise, it is replaced with its only parent.
</simpara>
</listitem>
</itemizedlist>
<simpara>The effect of this is best shown by way of comparing to
<emphasis>--full-history</emphasis> with parent rewriting.  The example turns into:</simpara>
<literallayout>          .-A---M---N---O
         /     /       /
        I     B       D
         \   /       /
          `---------'</literallayout>
<simpara>Note the major differences in <literal>N</literal> and <literal>P</literal> over <emphasis>--full-history</emphasis>:</simpara>
<itemizedlist>
<listitem>
<simpara>
<literal>N</literal>'s parent list had <literal>I</literal> removed, because it is an ancestor of the
  other parent <literal>M</literal>.  Still, <literal>N</literal> remained because it is !TREESAME.
</simpara>
</listitem>
<listitem>
<simpara>
<literal>P</literal>'s parent list similarly had <literal>I</literal> removed.  <literal>P</literal> was then
  removed completely, because it had one parent and is TREESAME.
</simpara>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
<simpara>The <emphasis>--simplify-by-decoration</emphasis> 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).</simpara>
</simplesect>
<simplesect id="_bisection_helpers">
<title>Bisection Helpers</title>
<variablelist>
<varlistentry>
<term>
--bisect
</term>
<listitem>
<simpara>
Limit output to the one commit object which is roughly halfway between
the included and excluded commits. Thus, if
</simpara>
</listitem>
</varlistentry>
</variablelist>
<literallayout>        $ git rev-list --bisect foo ^bar ^baz</literallayout>
<simpara>outputs <emphasis>midpoint</emphasis>, the output of the two commands</simpara>
<literallayout>        $ git rev-list foo ^midpoint
        $ git rev-list midpoint ^bar ^baz</literallayout>
<simpara>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 'midpoint&#8217;s until the commit chain is of length
one.</simpara>
<variablelist>
<varlistentry>
<term>
--bisect-vars
</term>
<listitem>
<simpara>
This calculates the same as <literal>--bisect</literal>, but outputs text ready
to be eval&#8217;ed by the shell. These lines will assign the name of
the midpoint revision to the variable <literal>bisect_rev</literal>, and the
expected number of commits to be tested after <literal>bisect_rev</literal> is
tested to <literal>bisect_nr</literal>, the expected number of commits to be
tested if <literal>bisect_rev</literal> turns out to be good to <literal>bisect_good</literal>,
the expected number of commits to be tested if <literal>bisect_rev</literal>
turns out to be bad to <literal>bisect_bad</literal>, and the number of commits
we are bisecting right now to <literal>bisect_all</literal>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--bisect-all
</term>
<listitem>
<simpara>
This outputs all the commit objects between the included and excluded
commits, ordered by their distance to the included and excluded
commits. The farthest from them is displayed first. (This is the only
one displayed by <literal>--bisect</literal>.)
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>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).</simpara>
<simpara>This option can be used along with <literal>--bisect-vars</literal>, in this case,
after all the sorted commit objects, there will be the same text as if
<literal>--bisect-vars</literal> had been used alone.</simpara>
</simplesect>
<simplesect id="_commit_ordering">
<title>Commit Ordering</title>
<simpara>By default, the commits are shown in reverse chronological order.</simpara>
<variablelist>
<varlistentry>
<term>
--topo-order
</term>
<listitem>
<simpara>
        This option makes them appear in topological order (i.e.
        descendant commits are shown before their parents).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--date-order
</term>
<listitem>
<simpara>
        This option is similar to <emphasis>--topo-order</emphasis> in the sense that no
        parent comes before all of its children, but otherwise things
        are still ordered in the commit timestamp order.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--reverse
</term>
<listitem>
<simpara>
        Output the commits in reverse order.
        Cannot be combined with <emphasis>--walk-reflogs</emphasis>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_object_traversal">
<title>Object Traversal</title>
<simpara>These options are mostly targeted for packing of git repositories.</simpara>
<variablelist>
<varlistentry>
<term>
--objects
</term>
<listitem>
<simpara>
        Print the object IDs of any object referenced by the listed
        commits.  <emphasis>--objects foo ^bar</emphasis> thus means "send me
        all object IDs which I need to download if I have the commit
        object <emphasis>bar</emphasis>, but not <emphasis>foo</emphasis>".
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--objects-edge
</term>
<listitem>
<simpara>
        Similar to <emphasis>--objects</emphasis>, but also print the IDs of excluded
        commits prefixed with a "-" character.  This is used by
        <xref linkend="git-pack-objects(1)"/> to build "thin" pack, which records
        objects in deltified form based on objects contained in these
        excluded commits to reduce network traffic.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--unpacked
</term>
<listitem>
<simpara>
        Only useful with <emphasis>--objects</emphasis>; print the object IDs that are not
        in packs.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-walk
</term>
<listitem>
<simpara>
        Only show the given revs, but do not traverse their ancestors.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--do-walk
</term>
<listitem>
<simpara>
        Overrides a previous --no-walk.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
</simplesect>
<simplesect id="_pretty_formats">
<title>PRETTY FORMATS</title>
<simpara>If the commit is a merge, and if the pretty-format
is not <emphasis>oneline</emphasis>, <emphasis>email</emphasis> or <emphasis>raw</emphasis>, an additional line is
inserted before the <emphasis>Author:</emphasis> 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 <emphasis role="strong">direct</emphasis> 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.</simpara>
<simpara>Here are some additional details for each format:</simpara>
<itemizedlist>
<listitem>
<simpara>
<emphasis>oneline</emphasis>
</simpara>
<literallayout class="monospaced">&lt;sha1&gt; &lt;title line&gt;</literallayout>
<simpara>This is designed to be as compact as possible.</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>short</emphasis>
</simpara>
<literallayout class="monospaced">commit &lt;sha1&gt;
Author: &lt;author&gt;</literallayout>
<literallayout class="monospaced">&lt;title line&gt;</literallayout>
</listitem>
<listitem>
<simpara>
<emphasis>medium</emphasis>
</simpara>
<literallayout class="monospaced">commit &lt;sha1&gt;
Author: &lt;author&gt;
Date:   &lt;author date&gt;</literallayout>
<literallayout class="monospaced">&lt;title line&gt;</literallayout>
<literallayout class="monospaced">&lt;full commit message&gt;</literallayout>
</listitem>
<listitem>
<simpara>
<emphasis>full</emphasis>
</simpara>
<literallayout class="monospaced">commit &lt;sha1&gt;
Author: &lt;author&gt;
Commit: &lt;committer&gt;</literallayout>
<literallayout class="monospaced">&lt;title line&gt;</literallayout>
<literallayout class="monospaced">&lt;full commit message&gt;</literallayout>
</listitem>
<listitem>
<simpara>
<emphasis>fuller</emphasis>
</simpara>
<literallayout class="monospaced">commit &lt;sha1&gt;
Author:     &lt;author&gt;
AuthorDate: &lt;author date&gt;
Commit:     &lt;committer&gt;
CommitDate: &lt;committer date&gt;</literallayout>
<literallayout class="monospaced">&lt;title line&gt;</literallayout>
<literallayout class="monospaced">&lt;full commit message&gt;</literallayout>
</listitem>
<listitem>
<simpara>
<emphasis>email</emphasis>
</simpara>
<literallayout class="monospaced">From &lt;sha1&gt; &lt;date&gt;
From: &lt;author&gt;
Date: &lt;author date&gt;
Subject: [PATCH] &lt;title line&gt;</literallayout>
<literallayout class="monospaced">&lt;full commit message&gt;</literallayout>
</listitem>
<listitem>
<simpara>
<emphasis>raw</emphasis>
</simpara>
<simpara>The <emphasis>raw</emphasis> 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 <emphasis>parents</emphasis> information show the
true parent commits, without taking grafts nor history
simplification into account.</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>format:</emphasis>
</simpara>
<simpara>The <emphasis>format:</emphasis> 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 <emphasis>%n</emphasis>
instead of <emphasis>\n</emphasis>.</simpara>
<simpara>E.g, <emphasis>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</emphasis>
would show something like this:</simpara>
<literallayout>The author of fe6e0ee was Junio C Hamano, 23 hours ago
The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</literallayout>
<simpara>The placeholders are:</simpara>
<itemizedlist>
<listitem>
<simpara>
<emphasis>%H</emphasis>: commit hash
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%h</emphasis>: abbreviated commit hash
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%T</emphasis>: tree hash
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%t</emphasis>: abbreviated tree hash
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%P</emphasis>: parent hashes
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%p</emphasis>: abbreviated parent hashes
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%an</emphasis>: author name
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%aN</emphasis>: author name (respecting .mailmap)
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%ae</emphasis>: author email
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%aE</emphasis>: author email (respecting .mailmap)
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%ad</emphasis>: author date (format respects --date= option)
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%aD</emphasis>: author date, RFC2822 style
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%ar</emphasis>: author date, relative
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%at</emphasis>: author date, UNIX timestamp
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%ai</emphasis>: author date, ISO 8601 format
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%cn</emphasis>: committer name
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%cN</emphasis>: committer name (respecting .mailmap)
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%ce</emphasis>: committer email
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%cE</emphasis>: committer email (respecting .mailmap)
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%cd</emphasis>: committer date
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%cD</emphasis>: committer date, RFC2822 style
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%cr</emphasis>: committer date, relative
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%ct</emphasis>: committer date, UNIX timestamp
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%ci</emphasis>: committer date, ISO 8601 format
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%d</emphasis>: ref names, like the --decorate option of <xref linkend="git-log(1)"/>
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%e</emphasis>: encoding
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%s</emphasis>: subject
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%b</emphasis>: body
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%Cred</emphasis>: switch color to red
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%Cgreen</emphasis>: switch color to green
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%Cblue</emphasis>: switch color to blue
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%Creset</emphasis>: reset color
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%C(&#8230;)</emphasis>: color specification, as described in color.branch.* config option
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%m</emphasis>: left, right or boundary mark
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%n</emphasis>: newline
</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>%x00</emphasis>: print a byte from a hex code
</simpara>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<simpara>
<emphasis>tformat:</emphasis>
</simpara>
<simpara>The <emphasis>tformat:</emphasis> format works exactly like <emphasis>format:</emphasis>, 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:</simpara>
<literallayout>$ git log -2 --pretty=format:%h 4da45bef \
  | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
4da45be
7134973 -- NO NEWLINE

$ git log -2 --pretty=tformat:%h 4da45bef \
  | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
4da45be
7134973</literallayout>
</listitem>
</itemizedlist>
</simplesect>
<simplesect id="_author">
<title>Author</title>
<simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;</simpara>
</simplesect>
<simplesect id="_documentation">
<title>Documentation</title>
<simpara>Documentation by David Greaves, Junio C Hamano, Jonas Fonseca
and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>
</simplesect>
<simplesect id="_git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
</simplesect>
</article>
