<?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-log(1)">
<articleinfo>
    <title>git-log(1)</title>
        <indexterm>
                <primary>git-log(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-log - Show commit logs</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<simpara><emphasis>git log</emphasis> [&lt;options&gt;] [&lt;since&gt;..&lt;until&gt;] [[--] &lt;path&gt;&#8230;]</simpara>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>Shows the commit logs.</simpara>
<simpara>The command takes options applicable to the <emphasis>git-rev-list</emphasis>
command to control what is shown and how, and options applicable to
the <emphasis>git-diff-*</emphasis> commands to control how the changes
each commit introduces are shown.</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
-p
</term>
<term>
-u
</term>
<listitem>
<simpara>
        Generate patch (see section on generating patches).
        
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-U&lt;n&gt;
</term>
<term>
--unified=&lt;n&gt;
</term>
<listitem>
<simpara>
        Generate diffs with &lt;n&gt; lines of context instead of
        the usual three. Implies "-p".
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--raw
</term>
<listitem>
<simpara>
        Generate the raw format.
        
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--patch-with-raw
</term>
<listitem>
<simpara>
        Synonym for "-p --raw".
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--patience
</term>
<listitem>
<simpara>
        Generate a diff using the "patience diff" algorithm.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--stat[=width[,name-width]]
</term>
<listitem>
<simpara>
        Generate a diffstat.  You can override the default
        output width for 80-column terminal by "--stat=width".
        The width of the filename part can be controlled by
        giving another width to it separated by a comma.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--numstat
</term>
<listitem>
<simpara>
        Similar to --stat, but shows number of added and
        deleted lines in decimal notation and pathname without
        abbreviation, to make it more machine friendly.  For
        binary files, outputs two <literal>-</literal> instead of saying
        <literal>0 0</literal>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--shortstat
</term>
<listitem>
<simpara>
        Output only the last line of the --stat format containing total
        number of modified files, as well as number of added and deleted
        lines.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--dirstat[=limit]
</term>
<listitem>
<simpara>
        Output the distribution of relative amount of changes (number of lines added or
        removed) for each sub-directory. Directories with changes below
        a cut-off percent (3% by default) are not shown. The cut-off percent
        can be set with "--dirstat=limit". Changes in a child directory is not
        counted for the parent directory, unless "--cumulative" is used.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--dirstat-by-file[=limit]
</term>
<listitem>
<simpara>
        Same as --dirstat, but counts changed files instead of lines.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--summary
</term>
<listitem>
<simpara>
        Output a condensed summary of extended header information
        such as creations, renames and mode changes.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--patch-with-stat
</term>
<listitem>
<simpara>
        Synonym for "-p --stat".
        
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-z
</term>
<listitem>
<simpara>
        NUL-line termination on output.  This affects the --raw
        output field terminator.  Also output from commands such
        as "git-log" will be delimited with NUL between commits.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--name-only
</term>
<listitem>
<simpara>
        Show only names of changed files.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--name-status
</term>
<listitem>
<simpara>
        Show only names and status of changed files. See the description
        of the <literal>--diff-filter</literal> option on what the status letters mean.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--color
</term>
<listitem>
<simpara>
        Show colored diff.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-color
</term>
<listitem>
<simpara>
        Turn off colored diff, even when the configuration file
        gives the default to color output.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--color-words[=&lt;regex&gt;]
</term>
<listitem>
<simpara>
        Show colored word diff, i.e., color words which have changed.
        By default, words are separated by whitespace.
</simpara>
<simpara>When a &lt;regex&gt; is specified, every non-overlapping match of the
&lt;regex&gt; is considered a word.  Anything between these matches is
considered whitespace and ignored(!) for the purposes of finding
differences.  You may want to append <literal>|[^[:space:]]</literal> to your regular
expression to make sure that it matches all non-whitespace characters.
A match that contains a newline is silently truncated(!) at the
newline.</simpara>
<simpara>The regex can also be set via a diff driver or configuration option, see
<xref linkend="gitattributes(1)"/> or <xref linkend="git-config(1)"/>.  Giving it explicitly
overrides any diff driver or configuration setting.  Diff drivers
override configuration settings.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-renames
</term>
<listitem>
<simpara>
        Turn off rename detection, even when the configuration
        file gives the default to do so.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--check
</term>
<listitem>
<simpara>
        Warn if changes introduce trailing whitespace
        or an indent that uses a space before a tab. Exits with
        non-zero status if problems are found. Not compatible with
        --exit-code.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--full-index
</term>
<listitem>
<simpara>
        Instead of the first handful of characters, show the full
        pre- and post-image blob object names on the "index"
        line when generating patch format output.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--binary
</term>
<listitem>
<simpara>
        In addition to --full-index, output "binary diff" that
        can be applied with "git apply".
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--abbrev[=&lt;n&gt;]
</term>
<listitem>
<simpara>
        Instead of showing the full 40-byte hexadecimal object
        name in diff-raw format output and diff-tree header
        lines, show only a partial prefix.  This is
        independent of --full-index option above, which controls
        the diff-patch output format.  Non default number of
        digits can be specified with --abbrev=&lt;n&gt;.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-B
</term>
<listitem>
<simpara>
        Break complete rewrite changes into pairs of delete and create.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-M
</term>
<listitem>
<simpara>
        Detect renames.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-C
</term>
<listitem>
<simpara>
        Detect copies as well as renames.  See also <literal>--find-copies-harder</literal>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--diff-filter=[ACDMRTUXB*]
</term>
<listitem>
<simpara>
        Select only files that are Added (<literal>A</literal>), Copied (<literal>C</literal>),
        Deleted (<literal>D</literal>), Modified (<literal>M</literal>), Renamed (<literal>R</literal>), have their
        type (i.e. regular file, symlink, submodule, &#8230;) changed (<literal>T</literal>),
        are Unmerged (<literal>U</literal>), are
        Unknown (<literal>X</literal>), or have had their pairing Broken (<literal>B</literal>).
        Any combination of the filter characters may be used.
        When <literal>*</literal> (All-or-none) is added to the combination, all
        paths are selected if there is any file that matches
        other criteria in the comparison; if there is no file
        that matches other criteria, nothing is selected.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--find-copies-harder
</term>
<listitem>
<simpara>
        For performance reasons, by default, <literal>-C</literal> option finds copies only
        if the original file of the copy was modified in the same
        changeset.  This flag makes the command
        inspect unmodified files as candidates for the source of
        copy.  This is a very expensive operation for large
        projects, so use it with caution.  Giving more than one
        <literal>-C</literal> option has the same effect.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-l&lt;num&gt;
</term>
<listitem>
<simpara>
        -M and -C options require O(n^2) processing time where n
        is the number of potential rename/copy targets.  This
        option prevents rename/copy detection from running if
        the number of rename/copy targets exceeds the specified
        number.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-S&lt;string&gt;
</term>
<listitem>
<simpara>
        Look for differences that contain the change in &lt;string&gt;.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--pickaxe-all
</term>
<listitem>
<simpara>
        When -S finds a change, show all the changes in that
        changeset, not just the files that contain the change
        in &lt;string&gt;.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--pickaxe-regex
</term>
<listitem>
<simpara>
        Make the &lt;string&gt; not a plain string but an extended POSIX
        regex to match.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-O&lt;orderfile&gt;
</term>
<listitem>
<simpara>
        Output the patch in the order specified in the
        &lt;orderfile&gt;, which has one shell glob pattern per line.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-R
</term>
<listitem>
<simpara>
        Swap two inputs; that is, show differences from index or
        on-disk file to tree contents.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--relative[=&lt;path&gt;]
</term>
<listitem>
<simpara>
        When run from a subdirectory of the project, it can be
        told to exclude changes outside the directory and show
        pathnames relative to it with this option.  When you are
        not in a subdirectory (e.g. in a bare repository), you
        can name which subdirectory to make the output relative
        to by giving a &lt;path&gt; as an argument.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-a
</term>
<term>
--text
</term>
<listitem>
<simpara>
        Treat all files as text.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--ignore-space-at-eol
</term>
<listitem>
<simpara>
        Ignore changes in whitespace at EOL.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-b
</term>
<term>
--ignore-space-change
</term>
<listitem>
<simpara>
        Ignore changes in amount of whitespace.  This ignores whitespace
        at line end, and considers all other sequences of one or
        more whitespace characters to be equivalent.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-w
</term>
<term>
--ignore-all-space
</term>
<listitem>
<simpara>
        Ignore whitespace when comparing lines.  This ignores
        differences even if one line has whitespace where the other
        line has none.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--inter-hunk-context=&lt;lines&gt;
</term>
<listitem>
<simpara>
        Show the context between diff hunks, up to the specified number
        of lines, thereby fusing hunks that are close to each other.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--exit-code
</term>
<listitem>
<simpara>
        Make the program exit with codes similar to diff(1).
        That is, it exits with 1 if there were differences and
        0 means no differences.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--quiet
</term>
<listitem>
<simpara>
        Disable all output of the program. Implies --exit-code.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--ext-diff
</term>
<listitem>
<simpara>
        Allow an external diff helper to be executed. If you set an
        external diff driver with <xref linkend="gitattributes(5)"/>, you need
        to use this option with <xref linkend="git-log(1)"/> and friends.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-ext-diff
</term>
<listitem>
<simpara>
        Disallow external diff drivers.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--ignore-submodules
</term>
<listitem>
<simpara>
        Ignore changes to submodules in the diff generation.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--src-prefix=&lt;prefix&gt;
</term>
<listitem>
<simpara>
        Show the given source prefix instead of "a/".
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--dst-prefix=&lt;prefix&gt;
</term>
<listitem>
<simpara>
        Show the given destination prefix instead of "b/".
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-prefix
</term>
<listitem>
<simpara>
        Do not show any source or destination prefix.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>For more detailed explanation on these common options, see also
<xref linkend="gitdiffcore(7)"/>.</simpara>
<variablelist>
<varlistentry>
<term>
-&lt;n&gt;
</term>
<listitem>
<simpara>
        Limits the number of commits to show.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
&lt;since&gt;..&lt;until&gt;
</term>
<listitem>
<simpara>
        Show only commits between the named two commits.  When
        either &lt;since&gt; or &lt;until&gt; is omitted, it defaults to
        <literal>HEAD</literal>, i.e. the tip of the current branch.
        For a more complete list of ways to spell &lt;since&gt;
        and &lt;until&gt;, see "SPECIFYING REVISIONS" section in
        <xref linkend="git-rev-parse(1)"/>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--decorate
</term>
<listitem>
<simpara>
        Print out the ref names of any commits that are shown.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--source
</term>
<listitem>
<simpara>
        Print out the ref name given on the command line by which each
        commit was reached.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--full-diff
</term>
<listitem>
<simpara>
        Without this flag, "git log -p &lt;path&gt;&#8230;" shows commits that
        touch the specified paths, and diffs about the same specified
        paths.  With this, the full diff is shown for commits that touch
        the specified paths; this means that "&lt;path&gt;&#8230;" limits only
        commits, and doesn&#8217;t limit diff for those commits.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--follow
</term>
<listitem>
<simpara>
        Continue listing the history of a file beyond renames.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--log-size
</term>
<listitem>
<simpara>
        Before the log message print out its size in bytes. Intended
        mainly for porcelain tools consumption. If git is unable to
        produce a valid value size is set to zero.
        Note that only message is considered, if also a diff is shown
        its size is not included.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
[--] &lt;path&gt;&#8230;
</term>
<listitem>
<simpara>
        Show only commits that affect any of the specified paths. To
        prevent confusion with options and branch names, paths may need
        to be prefixed with "-- " to separate them from options or
        refnames.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simplesect id="_commit_formatting">
<title>Commit Formatting</title>
<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>
--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>
--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="_diff_formatting">
<title>Diff Formatting</title>
<simpara>Below are listed options that control the formatting of diff output.
Some of them are specific to <xref linkend="git-rev-list(1)"/>, however other diff
options may be given. See <xref linkend="git-diff-files(1)"/> for more options.</simpara>
<variablelist>
<varlistentry>
<term>
-c
</term>
<listitem>
<simpara>
        This flag changes the way a merge commit is displayed.  It shows
        the differences from each of the parents to the merge result
        simultaneously instead of showing pairwise diff between a parent
        and the result one at a time. Furthermore, it lists only files
        which were modified from all parents.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--cc
</term>
<listitem>
<simpara>
        This flag implies the <emphasis>-c</emphasis> options and further compresses the
        patch output by omitting uninteresting hunks whose contents in
        the parents have only two variants and the merge result picks
        one of them without modification.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-r
</term>
<listitem>
<simpara>
        Show recursive diffs.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-t
</term>
<listitem>
<simpara>
        Show the tree objects in the diff output. This implies <emphasis>-r</emphasis>.
</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>
--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>
--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="_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="_generating_patches_with_p">
<title>Generating patches with -p</title>
<simpara>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
with a <emphasis>-p</emphasis> option, "git diff" without the <emphasis>--raw</emphasis> option, or
"git log" with the "-p" option, they
do not produce the output described above; instead they produce a
patch file.  You can customize the creation of such patches via the
GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</simpara>
<simpara>What the -p option produces is slightly different from the traditional
diff format.</simpara>
<orderedlist numeration="arabic">
<listitem>
<simpara>
It is preceded with a "git diff" header, that looks like
     this:
</simpara>
<literallayout class="monospaced">diff --git a/file1 b/file2</literallayout>
<simpara>The <literal>a/</literal> and <literal>b/</literal> filenames are the same unless rename/copy is
involved.  Especially, even for a creation or a deletion,
<literal>/dev/null</literal> is <emphasis>not</emphasis> used in place of <literal>a/</literal> or <literal>b/</literal> filenames.</simpara>
<simpara>When rename/copy is involved, <literal>file1</literal> and <literal>file2</literal> show the
name of the source file of the rename/copy and the name of
the file that rename/copy produces, respectively.</simpara>
</listitem>
<listitem>
<simpara>
It is followed by one or more extended header lines:
</simpara>
<literallayout class="monospaced">old mode &lt;mode&gt;
new mode &lt;mode&gt;
deleted file mode &lt;mode&gt;
new file mode &lt;mode&gt;
copy from &lt;path&gt;
copy to &lt;path&gt;
rename from &lt;path&gt;
rename to &lt;path&gt;
similarity index &lt;number&gt;
dissimilarity index &lt;number&gt;
index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</literallayout>
</listitem>
<listitem>
<simpara>
TAB, LF, double quote and backslash characters in pathnames
    are represented as <literal>\t</literal>, <literal>\n</literal>, <literal>\"</literal> and <literal>\\</literal>, respectively.
    If there is need for such substitution then the whole
    pathname is put in double quotes.
</simpara>
</listitem>
</orderedlist>
<simpara>The similarity index is the percentage of unchanged lines, and
the dissimilarity index is the percentage of changed lines.  It
is a rounded down integer, followed by a percent sign.  The
similarity index value of 100% is thus reserved for two equal
files, while 100% dissimilarity means that no line from the old
file made it into the new one.</simpara>
</simplesect>
<simplesect id="_combined_diff_format">
<title>combined diff format</title>
<simpara>"git-diff-tree", "git-diff-files" and "git-diff" can take <emphasis>-c</emphasis> or
<emphasis>--cc</emphasis> option to produce <emphasis>combined diff</emphasis>.  For showing a merge commit
with "git log -p", this is the default format.
A <emphasis>combined diff</emphasis> format looks like this:</simpara>
<literallayout>diff --combined describe.c
index fabadb8,cc95eb0..4866510
--- a/describe.c
+++ b/describe.c
@@@ -98,20 -98,12 +98,20 @@@
        return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
  }

- static void describe(char *arg)
 -static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
  {
 +      unsigned char sha1[20];
 +      struct commit *cmit;
        struct commit_list *list;
        static int initialized = 0;
        struct commit_name *n;

 +      if (get_sha1(arg, sha1) &lt; 0)
 +              usage(describe_usage);
 +      cmit = lookup_commit_reference(sha1);
 +      if (!cmit)
 +              usage(describe_usage);
 +
        if (!initialized) {
                initialized = 1;
                for_each_ref(get_name);</literallayout>
<orderedlist numeration="arabic">
<listitem>
<simpara>
It is preceded with a "git diff" header, that looks like
     this (when <emphasis>-c</emphasis> option is used):
</simpara>
<literallayout class="monospaced">diff --combined file</literallayout>
<simpara>or like this (when <emphasis>--cc</emphasis> option is used):</simpara>
<literallayout class="monospaced">diff --cc file</literallayout>
</listitem>
<listitem>
<simpara>
It is followed by one or more extended header lines
     (this example shows a merge with two parents):
</simpara>
<literallayout class="monospaced">index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
new file mode &lt;mode&gt;
deleted file mode &lt;mode&gt;,&lt;mode&gt;</literallayout>
<simpara>The <literal>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</literal> line appears only if at least one of
the &lt;mode&gt; is different from the rest. Extended headers with
information about detected contents movement (renames and
copying detection) are designed to work with diff of two
&lt;tree-ish&gt; and are not used by combined diff format.</simpara>
</listitem>
<listitem>
<simpara>
It is followed by two-line from-file/to-file header
</simpara>
<literallayout class="monospaced">--- a/file
+++ b/file</literallayout>
<simpara>Similar to two-line header for traditional <emphasis>unified</emphasis> diff
format, <literal>/dev/null</literal> is used to signal created or deleted
files.</simpara>
</listitem>
<listitem>
<simpara>
Chunk header format is modified to prevent people from
     accidentally feeding it to <literal>patch -p1</literal>. Combined diff format
     was created for review of merge commit changes, and was not
     meant for apply. The change is similar to the change in the
     extended <emphasis>index</emphasis> header:
</simpara>
<literallayout class="monospaced">@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</literallayout>
<simpara>There are (number of parents + 1) <literal>@</literal> characters in the chunk
header for combined diff format.</simpara>
</listitem>
</orderedlist>
<simpara>Unlike the traditional <emphasis>unified</emphasis> diff format, which shows two
files A and B with a single column that has <literal>-</literal> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <literal>+</literal> (plus&#8201;&#8212;&#8201;missing in A but
added to B), or <literal>" "</literal> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
compares two or more files file1, file2,&#8230; with one file X, and
shows how X differs from each of fileN.  One column for each of
fileN is prepended to the output line to note how X&#8217;s line is
different from it.</simpara>
<simpara>A <literal>-</literal> character in the column N means that the line appears in
fileN but it does not appear in the result.  A <literal>+</literal> character
in the column N means that the line appears in the result,
and fileN does not have that line (in other words, the line was
added, from the point of view of that parent).</simpara>
<simpara>In the above example output, the function signature was changed
from both files (hence two <literal>-</literal> removals from both file1 and
file2, plus <literal>++</literal> to mean one line that was added does not appear
in either file1 nor file2).  Also eight other lines are the same
from file1 but do not appear in file2 (hence prefixed with <literal>&#43;</literal>).</simpara>
<simpara>When shown by <literal>git diff-tree -c</literal>, it compares the parents of a
merge commit with the merge result (i.e. file1..fileN are the
parents).  When shown by <literal>git diff-files -c</literal>, it compares the
two unresolved merge parents with the working tree file
(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
"their version").</simpara>
</simplesect>
<simplesect id="_examples">
<title>Examples</title>
<variablelist>
<varlistentry>
<term>
git log --no-merges
</term>
<listitem>
<simpara>
        Show the whole commit history, but skip any merges
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
git log v2.6.12.. include/scsi drivers/scsi
</term>
<listitem>
<simpara>
        Show all commits since version <emphasis>v2.6.12</emphasis> that changed any file
        in the include/scsi or drivers/scsi subdirectories
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
git log --since="2 weeks ago" -- gitk
</term>
<listitem>
<simpara>
        Show the changes during the last two weeks to the file <emphasis>gitk</emphasis>.
        The "--" is necessary to avoid confusion with the <emphasis role="strong">branch</emphasis> named
        <emphasis>gitk</emphasis>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
git log --name-status release..test
</term>
<listitem>
<simpara>
        Show the commits that are in the "test" branch but not yet
        in the "release" branch, along with the list of paths
        each commit modifies.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
git log --follow builtin-rev-list.c
</term>
<listitem>
<simpara>
        Shows the commits that changed builtin-rev-list.c, including
        those commits that occurred before the file was given its
        present name.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_discussion">
<title>Discussion</title>
<simpara>At the core level, git is character encoding agnostic.</simpara>
<itemizedlist>
<listitem>
<simpara>
The pathnames recorded in the index and in the tree objects
   are treated as uninterpreted sequences of non-NUL bytes.
   What readdir(2) returns are what are recorded and compared
   with the data git keeps track of, which in turn are expected
   to be what lstat(2) and creat(2) accepts.  There is no such
   thing as pathname encoding translation.
</simpara>
</listitem>
<listitem>
<simpara>
The contents of the blob objects are uninterpreted sequences
   of bytes.  There is no encoding translation at the core
   level.
</simpara>
</listitem>
<listitem>
<simpara>
The commit log messages are uninterpreted sequences of non-NUL
   bytes.
</simpara>
</listitem>
</itemizedlist>
<simpara>Although we encourage that the commit log messages are encoded
in UTF-8, both the core and git Porcelain are designed not to
force UTF-8 on projects.  If all participants of a particular
project find it more convenient to use legacy encodings, git
does not forbid it.  However, there are a few things to keep in
mind.</simpara>
<orderedlist numeration="arabic">
<listitem>
<simpara>
<emphasis>git-commit</emphasis> and <emphasis>git-commit-tree</emphasis> issues
  a warning if the commit log message given to it does not look
  like a valid UTF-8 string, unless you explicitly say your
  project uses a legacy encoding.  The way to say this is to
  have i18n.commitencoding in <literal>.git/config</literal> file, like this:
</simpara>
<literallayout>[i18n]
        commitencoding = ISO-8859-1</literallayout>
<simpara>Commit objects created with the above setting record the value
of <literal>i18n.commitencoding</literal> in its <literal>encoding</literal> header.  This is to
help other people who look at them later.  Lack of this header
implies that the commit log message is encoded in UTF-8.</simpara>
</listitem>
<listitem>
<simpara>
<emphasis>git-log</emphasis>, <emphasis>git-show</emphasis>, <emphasis>git-blame</emphasis> and friends look at the
  <literal>encoding</literal> header of a commit object, and try to re-code the
  log message into UTF-8 unless otherwise specified.  You can
  specify the desired output encoding with
  <literal>i18n.logoutputencoding</literal> in <literal>.git/config</literal> file, like this:
</simpara>
<literallayout>[i18n]
        logoutputencoding = ISO-8859-1</literallayout>
<simpara>If you do not have this configuration variable, the value of
<literal>i18n.commitencoding</literal> is used instead.</simpara>
</listitem>
</orderedlist>
<simpara>Note that we deliberately chose not to re-code the commit log
message when a commit is made to force UTF-8 at the commit
object level, because re-coding to UTF-8 is not necessarily a
reversible operation.</simpara>
</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 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>
