OSDN Git Service

Add Git official document to help
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / git-diff.html.xml
diff --git a/doc/source/en/TortoiseGit/git_doc/git-diff.html.xml b/doc/source/en/TortoiseGit/git_doc/git-diff.html.xml
new file mode 100644 (file)
index 0000000..45719e3
--- /dev/null
@@ -0,0 +1,1366 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
+\r
+<article lang="en" id="git-diff(1)">\r
+<articleinfo>\r
+    <title>git-diff(1)</title>\r
+        <indexterm>\r
+                <primary>git-diff(1)</primary>\r
+        </indexterm>\r
+</articleinfo>\r
+<simplesect id="_name">\r
+<title>NAME</title>\r
+<simpara>git-diff - Show changes between commits, commit and working tree, etc</simpara>\r
+</simplesect>\r
+<simplesect id="_synopsis">\r
+<title>SYNOPSIS</title>\r
+<simpara><emphasis>git diff</emphasis> [&lt;common diff options&gt;] &lt;commit&gt;{0,2} [--] [&lt;path&gt;&#8230;]</simpara>\r
+</simplesect>\r
+<simplesect id="_description">\r
+<title>DESCRIPTION</title>\r
+<simpara>Show changes between two trees, a tree and the working tree, a\r
+tree and the index file, or the index file and the working tree.</simpara>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+<emphasis>git diff</emphasis> [--options] [--] [&lt;path&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        This form is to view the changes you made relative to\r
+        the index (staging area for the next commit).  In other\r
+        words, the differences are what you <emphasis>could</emphasis> tell git to\r
+        further add to the index but you still haven&#8217;t.  You can\r
+        stage these changes by using <xref linkend="git-add(1)"/>.\r
+</simpara>\r
+<simpara>If exactly two paths are given, and at least one is untracked,\r
+compare the two files / directories. This behavior can be\r
+forced by --no-index.</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+<emphasis>git diff</emphasis> [--options] --cached [&lt;commit&gt;] [--] [&lt;path&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        This form is to view the changes you staged for the next\r
+        commit relative to the named &lt;commit&gt;.  Typically you\r
+        would want comparison with the latest commit, so if you\r
+        do not give &lt;commit&gt;, it defaults to HEAD.\r
+        --staged is a synonym of --cached.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+<emphasis>git diff</emphasis> [--options] &lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        This form is to view the changes you have in your\r
+        working tree relative to the named &lt;commit&gt;.  You can\r
+        use HEAD to compare it with the latest commit, or a\r
+        branch name to compare with the tip of a different\r
+        branch.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+<emphasis>git diff</emphasis> [--options] &lt;commit&gt; &lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        This is to view the changes between two arbitrary\r
+        &lt;commit&gt;.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+<emphasis>git diff</emphasis> [--options] &lt;commit&gt;..&lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        This is synonymous to the previous form.  If &lt;commit&gt; on\r
+        one side is omitted, it will have the same effect as\r
+        using HEAD instead.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+<emphasis>git diff</emphasis> [--options] &lt;commit&gt;...&lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        This form is to view the changes on the branch containing\r
+        and up to the second &lt;commit&gt;, starting at a common ancestor\r
+        of both &lt;commit&gt;.  "git diff A...B" is equivalent to\r
+        "git diff $(git-merge-base A B) B".  You can omit any one\r
+        of &lt;commit&gt;, which has the same effect as using HEAD instead.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+<simpara>Just in case if you are doing something exotic, it should be\r
+noted that all of the &lt;commit&gt; in the above description, except\r
+for the last two forms that use ".." notations, can be any\r
+&lt;tree-ish&gt;.</simpara>\r
+<simpara>For a more complete list of ways to spell &lt;commit&gt;, see\r
+"SPECIFYING REVISIONS" section in <xref linkend="git-rev-parse(1)"/>.\r
+However, "diff" is about comparing two <emphasis>endpoints</emphasis>, not ranges,\r
+and the range notations ("&lt;commit&gt;..&lt;commit&gt;" and\r
+"&lt;commit&gt;...&lt;commit&gt;") do not mean a range as defined in the\r
+"SPECIFYING RANGES" section in <xref linkend="git-rev-parse(1)"/>.</simpara>\r
+</simplesect>\r
+<simplesect id="_options">\r
+<title>OPTIONS</title>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+-p\r
+</term>\r
+<term>\r
+-u\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Generate patch (see section on generating patches).\r
+         This is the default.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-U&lt;n&gt;\r
+</term>\r
+<term>\r
+--unified=&lt;n&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Generate diffs with &lt;n&gt; lines of context instead of\r
+        the usual three. Implies "-p".\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--raw\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Generate the raw format.\r
+        \r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--patch-with-raw\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Synonym for "-p --raw".\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--patience\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Generate a diff using the "patience diff" algorithm.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--stat[=width[,name-width]]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Generate a diffstat.  You can override the default\r
+        output width for 80-column terminal by "--stat=width".\r
+        The width of the filename part can be controlled by\r
+        giving another width to it separated by a comma.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--numstat\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Similar to --stat, but shows number of added and\r
+        deleted lines in decimal notation and pathname without\r
+        abbreviation, to make it more machine friendly.  For\r
+        binary files, outputs two <literal>-</literal> instead of saying\r
+        <literal>0 0</literal>.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--shortstat\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Output only the last line of the --stat format containing total\r
+        number of modified files, as well as number of added and deleted\r
+        lines.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--dirstat[=limit]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Output the distribution of relative amount of changes (number of lines added or\r
+        removed) for each sub-directory. Directories with changes below\r
+        a cut-off percent (3% by default) are not shown. The cut-off percent\r
+        can be set with "--dirstat=limit". Changes in a child directory is not\r
+        counted for the parent directory, unless "--cumulative" is used.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--dirstat-by-file[=limit]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Same as --dirstat, but counts changed files instead of lines.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--summary\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Output a condensed summary of extended header information\r
+        such as creations, renames and mode changes.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--patch-with-stat\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Synonym for "-p --stat".\r
+        \r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-z\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        NUL-line termination on output.  This affects the --raw\r
+        output field terminator.  Also output from commands such\r
+        as "git-log" will be delimited with NUL between commits.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--name-only\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Show only names of changed files.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--name-status\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Show only names and status of changed files. See the description\r
+        of the <literal>--diff-filter</literal> option on what the status letters mean.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--color\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Show colored diff.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--no-color\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Turn off colored diff, even when the configuration file\r
+        gives the default to color output.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--color-words[=&lt;regex&gt;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Show colored word diff, i.e., color words which have changed.\r
+        By default, words are separated by whitespace.\r
+</simpara>\r
+<simpara>When a &lt;regex&gt; is specified, every non-overlapping match of the\r
+&lt;regex&gt; is considered a word.  Anything between these matches is\r
+considered whitespace and ignored(!) for the purposes of finding\r
+differences.  You may want to append <literal>|[^[:space:]]</literal> to your regular\r
+expression to make sure that it matches all non-whitespace characters.\r
+A match that contains a newline is silently truncated(!) at the\r
+newline.</simpara>\r
+<simpara>The regex can also be set via a diff driver or configuration option, see\r
+<xref linkend="gitattributes(1)"/> or <xref linkend="git-config(1)"/>.  Giving it explicitly\r
+overrides any diff driver or configuration setting.  Diff drivers\r
+override configuration settings.</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--no-renames\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Turn off rename detection, even when the configuration\r
+        file gives the default to do so.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--check\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Warn if changes introduce trailing whitespace\r
+        or an indent that uses a space before a tab. Exits with\r
+        non-zero status if problems are found. Not compatible with\r
+        --exit-code.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--full-index\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Instead of the first handful of characters, show the full\r
+        pre- and post-image blob object names on the "index"\r
+        line when generating patch format output.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--binary\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        In addition to --full-index, output "binary diff" that\r
+        can be applied with "git apply".\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--abbrev[=&lt;n&gt;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Instead of showing the full 40-byte hexadecimal object\r
+        name in diff-raw format output and diff-tree header\r
+        lines, show only a partial prefix.  This is\r
+        independent of --full-index option above, which controls\r
+        the diff-patch output format.  Non default number of\r
+        digits can be specified with --abbrev=&lt;n&gt;.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-B\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Break complete rewrite changes into pairs of delete and create.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-M\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Detect renames.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-C\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Detect copies as well as renames.  See also <literal>--find-copies-harder</literal>.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--diff-filter=[ACDMRTUXB*]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Select only files that are Added (<literal>A</literal>), Copied (<literal>C</literal>),\r
+        Deleted (<literal>D</literal>), Modified (<literal>M</literal>), Renamed (<literal>R</literal>), have their\r
+        type (i.e. regular file, symlink, submodule, &#8230;) changed (<literal>T</literal>),\r
+        are Unmerged (<literal>U</literal>), are\r
+        Unknown (<literal>X</literal>), or have had their pairing Broken (<literal>B</literal>).\r
+        Any combination of the filter characters may be used.\r
+        When <literal>*</literal> (All-or-none) is added to the combination, all\r
+        paths are selected if there is any file that matches\r
+        other criteria in the comparison; if there is no file\r
+        that matches other criteria, nothing is selected.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--find-copies-harder\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        For performance reasons, by default, <literal>-C</literal> option finds copies only\r
+        if the original file of the copy was modified in the same\r
+        changeset.  This flag makes the command\r
+        inspect unmodified files as candidates for the source of\r
+        copy.  This is a very expensive operation for large\r
+        projects, so use it with caution.  Giving more than one\r
+        <literal>-C</literal> option has the same effect.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-l&lt;num&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        -M and -C options require O(n^2) processing time where n\r
+        is the number of potential rename/copy targets.  This\r
+        option prevents rename/copy detection from running if\r
+        the number of rename/copy targets exceeds the specified\r
+        number.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-S&lt;string&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Look for differences that contain the change in &lt;string&gt;.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--pickaxe-all\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        When -S finds a change, show all the changes in that\r
+        changeset, not just the files that contain the change\r
+        in &lt;string&gt;.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--pickaxe-regex\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Make the &lt;string&gt; not a plain string but an extended POSIX\r
+        regex to match.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-O&lt;orderfile&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Output the patch in the order specified in the\r
+        &lt;orderfile&gt;, which has one shell glob pattern per line.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-R\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Swap two inputs; that is, show differences from index or\r
+        on-disk file to tree contents.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--relative[=&lt;path&gt;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        When run from a subdirectory of the project, it can be\r
+        told to exclude changes outside the directory and show\r
+        pathnames relative to it with this option.  When you are\r
+        not in a subdirectory (e.g. in a bare repository), you\r
+        can name which subdirectory to make the output relative\r
+        to by giving a &lt;path&gt; as an argument.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-a\r
+</term>\r
+<term>\r
+--text\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Treat all files as text.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--ignore-space-at-eol\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Ignore changes in whitespace at EOL.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-b\r
+</term>\r
+<term>\r
+--ignore-space-change\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Ignore changes in amount of whitespace.  This ignores whitespace\r
+        at line end, and considers all other sequences of one or\r
+        more whitespace characters to be equivalent.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+-w\r
+</term>\r
+<term>\r
+--ignore-all-space\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Ignore whitespace when comparing lines.  This ignores\r
+        differences even if one line has whitespace where the other\r
+        line has none.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--inter-hunk-context=&lt;lines&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Show the context between diff hunks, up to the specified number\r
+        of lines, thereby fusing hunks that are close to each other.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--exit-code\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Make the program exit with codes similar to diff(1).\r
+        That is, it exits with 1 if there were differences and\r
+        0 means no differences.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--quiet\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Disable all output of the program. Implies --exit-code.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--ext-diff\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Allow an external diff helper to be executed. If you set an\r
+        external diff driver with <xref linkend="gitattributes(5)"/>, you need\r
+        to use this option with <xref linkend="git-log(1)"/> and friends.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--no-ext-diff\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Disallow external diff drivers.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--ignore-submodules\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Ignore changes to submodules in the diff generation.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--src-prefix=&lt;prefix&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Show the given source prefix instead of "a/".\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--dst-prefix=&lt;prefix&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Show the given destination prefix instead of "b/".\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+--no-prefix\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        Do not show any source or destination prefix.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+<simpara>For more detailed explanation on these common options, see also\r
+<xref linkend="gitdiffcore(7)"/>.</simpara>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+&lt;path&gt;&#8230;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        The &lt;paths&gt; parameters, when given, are used to limit\r
+        the diff to the named paths (you can give directory\r
+        names and get diff for all files under them).\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+</simplesect>\r
+<simplesect id="_output_format">\r
+<title>Output format</title>\r
+<simpara>The output format from "git-diff-index", "git-diff-tree",\r
+"git-diff-files" and "git diff --raw" are very similar.</simpara>\r
+<simpara>These commands all compare two sets of things; what is\r
+compared differs:</simpara>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+git-diff-index &lt;tree-ish&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        compares the &lt;tree-ish&gt; and the files on the filesystem.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+git-diff-index --cached &lt;tree-ish&gt;\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        compares the &lt;tree-ish&gt; and the index.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        compares the trees named by the two arguments.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+git-diff-files [&lt;pattern&gt;&#8230;]\r
+</term>\r
+<listitem>\r
+<simpara>\r
+        compares the index and the files on the filesystem.\r
+</simpara>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+<simpara>An output line is formatted this way:</simpara>\r
+<literallayout>in-place edit  :100644 100644 bcd1234... 0123456... M file0\r
+copy-edit      :100644 100644 abcd123... 1234567... C68 file1 file2\r
+rename-edit    :100644 100644 abcd123... 1234567... R86 file1 file3\r
+create         :000000 100644 0000000... 1234567... A file4\r
+delete         :100644 000000 1234567... 0000000... D file5\r
+unmerged       :000000 000000 0000000... 0000000... U file6</literallayout>\r
+<simpara>That is, from the left to the right:</simpara>\r
+<orderedlist numeration="arabic">\r
+<listitem>\r
+<simpara>\r
+a colon.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+mode for "src"; 000000 if creation or unmerged.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a space.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+mode for "dst"; 000000 if deletion or unmerged.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a space.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+sha1 for "src"; 0{40} if creation or unmerged.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a space.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a space.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+status, followed by optional "score" number.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a tab or a NUL when <emphasis>-z</emphasis> option is used.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+path for "src"\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a tab or a NUL when <emphasis>-z</emphasis> option is used; only exists for C or R.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+path for "dst"; only exists for C or R.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+an LF or a NUL when <emphasis>-z</emphasis> option is used, to terminate the record.\r
+</simpara>\r
+</listitem>\r
+</orderedlist>\r
+<simpara>Possible status letters are:</simpara>\r
+<itemizedlist>\r
+<listitem>\r
+<simpara>\r
+A: addition of a file\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+C: copy of a file into a new one\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+D: deletion of a file\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+M: modification of the contents or mode of a file\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+R: renaming of a file\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+T: change in the type of the file\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+U: file is unmerged (you must complete the merge before it can\r
+be committed)\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+X: "unknown" change type (most probably a bug, please report it)\r
+</simpara>\r
+</listitem>\r
+</itemizedlist>\r
+<simpara>Status letters C and R are always followed by a score (denoting the\r
+percentage of similarity between the source and target of the move or\r
+copy), and are the only ones to be so.</simpara>\r
+<simpara>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem\r
+and it is out of sync with the index.</simpara>\r
+<simpara>Example:</simpara>\r
+<literallayout>:100644 100644 5be4a4...... 000000...... M file.c</literallayout>\r
+<simpara>When <literal>-z</literal> option is not used, TAB, LF, and backslash characters\r
+in pathnames are represented as <literal>\t</literal>, <literal>\n</literal>, and <literal>\\</literal>,\r
+respectively.</simpara>\r
+</simplesect>\r
+<simplesect id="_diff_format_for_merges">\r
+<title>diff format for merges</title>\r
+<simpara>"git-diff-tree", "git-diff-files" and "git-diff --raw"\r
+can take <emphasis>-c</emphasis> or <emphasis>--cc</emphasis> option\r
+to generate diff output also for merge commits.  The output differs\r
+from the format described above in the following way:</simpara>\r
+<orderedlist numeration="arabic">\r
+<listitem>\r
+<simpara>\r
+there is a colon for each parent\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+there are more "src" modes and "src" sha1\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+status is concatenated status characters for each parent\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+no optional "score" number\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+single path, only for "dst"\r
+</simpara>\r
+</listitem>\r
+</orderedlist>\r
+<simpara>Example:</simpara>\r
+<literallayout>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c</literallayout>\r
+<simpara>Note that <emphasis>combined diff</emphasis> lists only files which were modified from\r
+all parents.</simpara>\r
+</simplesect>\r
+<simplesect id="_generating_patches_with_p">\r
+<title>Generating patches with -p</title>\r
+<simpara>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run\r
+with a <emphasis>-p</emphasis> option, "git diff" without the <emphasis>--raw</emphasis> option, or\r
+"git log" with the "-p" option, they\r
+do not produce the output described above; instead they produce a\r
+patch file.  You can customize the creation of such patches via the\r
+GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</simpara>\r
+<simpara>What the -p option produces is slightly different from the traditional\r
+diff format.</simpara>\r
+<orderedlist numeration="arabic">\r
+<listitem>\r
+<simpara>\r
+It is preceded with a "git diff" header, that looks like\r
+     this:\r
+</simpara>\r
+<literallayout class="monospaced">diff --git a/file1 b/file2</literallayout>\r
+<simpara>The <literal>a/</literal> and <literal>b/</literal> filenames are the same unless rename/copy is\r
+involved.  Especially, even for a creation or a deletion,\r
+<literal>/dev/null</literal> is <emphasis>not</emphasis> used in place of <literal>a/</literal> or <literal>b/</literal> filenames.</simpara>\r
+<simpara>When rename/copy is involved, <literal>file1</literal> and <literal>file2</literal> show the\r
+name of the source file of the rename/copy and the name of\r
+the file that rename/copy produces, respectively.</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+It is followed by one or more extended header lines:\r
+</simpara>\r
+<literallayout class="monospaced">old mode &lt;mode&gt;\r
+new mode &lt;mode&gt;\r
+deleted file mode &lt;mode&gt;\r
+new file mode &lt;mode&gt;\r
+copy from &lt;path&gt;\r
+copy to &lt;path&gt;\r
+rename from &lt;path&gt;\r
+rename to &lt;path&gt;\r
+similarity index &lt;number&gt;\r
+dissimilarity index &lt;number&gt;\r
+index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</literallayout>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+TAB, LF, double quote and backslash characters in pathnames\r
+    are represented as <literal>\t</literal>, <literal>\n</literal>, <literal>\"</literal> and <literal>\\</literal>, respectively.\r
+    If there is need for such substitution then the whole\r
+    pathname is put in double quotes.\r
+</simpara>\r
+</listitem>\r
+</orderedlist>\r
+<simpara>The similarity index is the percentage of unchanged lines, and\r
+the dissimilarity index is the percentage of changed lines.  It\r
+is a rounded down integer, followed by a percent sign.  The\r
+similarity index value of 100% is thus reserved for two equal\r
+files, while 100% dissimilarity means that no line from the old\r
+file made it into the new one.</simpara>\r
+</simplesect>\r
+<simplesect id="_combined_diff_format">\r
+<title>combined diff format</title>\r
+<simpara>"git-diff-tree", "git-diff-files" and "git-diff" can take <emphasis>-c</emphasis> or\r
+<emphasis>--cc</emphasis> option to produce <emphasis>combined diff</emphasis>.  For showing a merge commit\r
+with "git log -p", this is the default format.\r
+A <emphasis>combined diff</emphasis> format looks like this:</simpara>\r
+<literallayout>diff --combined describe.c\r
+index fabadb8,cc95eb0..4866510\r
+--- a/describe.c\r
++++ b/describe.c\r
+@@@ -98,20 -98,12 +98,20 @@@\r
+        return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;\r
+  }\r
+\r
+- static void describe(char *arg)\r
+ -static void describe(struct commit *cmit, int last_one)\r
+++static void describe(char *arg, int last_one)\r
+  {\r
+ +      unsigned char sha1[20];\r
+ +      struct commit *cmit;\r
+        struct commit_list *list;\r
+        static int initialized = 0;\r
+        struct commit_name *n;\r
+\r
+ +      if (get_sha1(arg, sha1) &lt; 0)\r
+ +              usage(describe_usage);\r
+ +      cmit = lookup_commit_reference(sha1);\r
+ +      if (!cmit)\r
+ +              usage(describe_usage);\r
+ +\r
+        if (!initialized) {\r
+                initialized = 1;\r
+                for_each_ref(get_name);</literallayout>\r
+<orderedlist numeration="arabic">\r
+<listitem>\r
+<simpara>\r
+It is preceded with a "git diff" header, that looks like\r
+     this (when <emphasis>-c</emphasis> option is used):\r
+</simpara>\r
+<literallayout class="monospaced">diff --combined file</literallayout>\r
+<simpara>or like this (when <emphasis>--cc</emphasis> option is used):</simpara>\r
+<literallayout class="monospaced">diff --cc file</literallayout>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+It is followed by one or more extended header lines\r
+     (this example shows a merge with two parents):\r
+</simpara>\r
+<literallayout class="monospaced">index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;\r
+mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;\r
+new file mode &lt;mode&gt;\r
+deleted file mode &lt;mode&gt;,&lt;mode&gt;</literallayout>\r
+<simpara>The <literal>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</literal> line appears only if at least one of\r
+the &lt;mode&gt; is different from the rest. Extended headers with\r
+information about detected contents movement (renames and\r
+copying detection) are designed to work with diff of two\r
+&lt;tree-ish&gt; and are not used by combined diff format.</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+It is followed by two-line from-file/to-file header\r
+</simpara>\r
+<literallayout class="monospaced">--- a/file\r
++++ b/file</literallayout>\r
+<simpara>Similar to two-line header for traditional <emphasis>unified</emphasis> diff\r
+format, <literal>/dev/null</literal> is used to signal created or deleted\r
+files.</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+Chunk header format is modified to prevent people from\r
+     accidentally feeding it to <literal>patch -p1</literal>. Combined diff format\r
+     was created for review of merge commit changes, and was not\r
+     meant for apply. The change is similar to the change in the\r
+     extended <emphasis>index</emphasis> header:\r
+</simpara>\r
+<literallayout class="monospaced">@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</literallayout>\r
+<simpara>There are (number of parents + 1) <literal>@</literal> characters in the chunk\r
+header for combined diff format.</simpara>\r
+</listitem>\r
+</orderedlist>\r
+<simpara>Unlike the traditional <emphasis>unified</emphasis> diff format, which shows two\r
+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\r
+added to B), or <literal>" "</literal> (space&#8201;&#8212;&#8201;unchanged) prefix, this format\r
+compares two or more files file1, file2,&#8230; with one file X, and\r
+shows how X differs from each of fileN.  One column for each of\r
+fileN is prepended to the output line to note how X&#8217;s line is\r
+different from it.</simpara>\r
+<simpara>A <literal>-</literal> character in the column N means that the line appears in\r
+fileN but it does not appear in the result.  A <literal>+</literal> character\r
+in the column N means that the line appears in the result,\r
+and fileN does not have that line (in other words, the line was\r
+added, from the point of view of that parent).</simpara>\r
+<simpara>In the above example output, the function signature was changed\r
+from both files (hence two <literal>-</literal> removals from both file1 and\r
+file2, plus <literal>++</literal> to mean one line that was added does not appear\r
+in either file1 nor file2).  Also eight other lines are the same\r
+from file1 but do not appear in file2 (hence prefixed with <literal>&#43;</literal>).</simpara>\r
+<simpara>When shown by <literal>git diff-tree -c</literal>, it compares the parents of a\r
+merge commit with the merge result (i.e. file1..fileN are the\r
+parents).  When shown by <literal>git diff-files -c</literal>, it compares the\r
+two unresolved merge parents with the working tree file\r
+(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka\r
+"their version").</simpara>\r
+</simplesect>\r
+<simplesect id="_other_diff_formats">\r
+<title>other diff formats</title>\r
+<simpara>The <literal>--summary</literal> option describes newly added, deleted, renamed and\r
+copied files.  The <literal>--stat</literal> option adds diffstat(1) graph to the\r
+output.  These options can be combined with other options, such as\r
+<literal>-p</literal>, and are meant for human consumption.</simpara>\r
+<simpara>When showing a change that involves a rename or a copy, <literal>--stat</literal> output\r
+formats the pathnames compactly by combining common prefix and suffix of\r
+the pathnames.  For example, a change that moves <literal>arch/i386/Makefile</literal> to\r
+<literal>arch/x86/Makefile</literal> while modifying 4 lines will be shown like this:</simpara>\r
+<literallayout>arch/{i386 =&gt; x86}/Makefile    |   4 +--</literallayout>\r
+<simpara>The <literal>--numstat</literal> option gives the diffstat(1) information but is designed\r
+for easier machine consumption.  An entry in <literal>--numstat</literal> output looks\r
+like this:</simpara>\r
+<literallayout>1       2       README\r
+3       1       arch/{i386 =&gt; x86}/Makefile</literallayout>\r
+<simpara>That is, from left to right:</simpara>\r
+<orderedlist numeration="arabic">\r
+<listitem>\r
+<simpara>\r
+the number of added lines;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a tab;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+the number of deleted lines;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a tab;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+pathname (possibly with rename/copy information);\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a newline.\r
+</simpara>\r
+</listitem>\r
+</orderedlist>\r
+<simpara>When <literal>-z</literal> output option is in effect, the output is formatted this way:</simpara>\r
+<literallayout>1       2       README NUL\r
+3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</literallayout>\r
+<simpara>That is:</simpara>\r
+<orderedlist numeration="arabic">\r
+<listitem>\r
+<simpara>\r
+the number of added lines;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a tab;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+the number of deleted lines;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a tab;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a NUL (only exists if renamed/copied);\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+pathname in preimage;\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a NUL (only exists if renamed/copied);\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+pathname in postimage (only exists if renamed/copied);\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+a NUL.\r
+</simpara>\r
+</listitem>\r
+</orderedlist>\r
+<simpara>The extra <literal>NUL</literal> before the preimage path in renamed case is to allow\r
+scripts that read the output to tell if the current record being read is\r
+a single-path record or a rename/copy record without reading ahead.\r
+After reading added and deleted lines, reading up to <literal>NUL</literal> would yield\r
+the pathname, but if that is <literal>NUL</literal>, the record will show two paths.</simpara>\r
+</simplesect>\r
+<simplesect id="_examples">\r
+<title>EXAMPLES</title>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+Various ways to check your working tree\r
+</term>\r
+<listitem>\r
+<literallayout>$ git diff            <co id="CO1-1"/>\r
+$ git diff --cached   <co id="CO1-2"/>\r
+$ git diff HEAD       <co id="CO1-3"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO1-1">\r
+<simpara>\r
+Changes in the working tree not yet staged for the next commit.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO1-2">\r
+<simpara>\r
+Changes between the index and your last commit; what you\r
+would be committing if you run "git commit" without "-a" option.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO1-3">\r
+<simpara>\r
+Changes in the working tree since your last commit; what you\r
+would be committing if you run "git commit -a"\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Comparing with arbitrary commits\r
+</term>\r
+<listitem>\r
+<literallayout>$ git diff test            <co id="CO2-1"/>\r
+$ git diff HEAD -- ./test  <co id="CO2-2"/>\r
+$ git diff HEAD^ HEAD      <co id="CO2-3"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO2-1">\r
+<simpara>\r
+Instead of using the tip of the current branch, compare with the\r
+tip of "test" branch.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO2-2">\r
+<simpara>\r
+Instead of comparing with the tip of "test" branch, compare with\r
+the tip of the current branch, but limit the comparison to the\r
+file "test".\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO2-3">\r
+<simpara>\r
+Compare the version before the last commit and the last commit.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Comparing branches\r
+</term>\r
+<listitem>\r
+<literallayout>$ git diff topic master    <co id="CO3-1"/>\r
+$ git diff topic..master   <co id="CO3-2"/>\r
+$ git diff topic...master  <co id="CO3-3"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO3-1">\r
+<simpara>\r
+Changes between the tips of the topic and the master branches.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO3-2">\r
+<simpara>\r
+Same as above.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO3-3">\r
+<simpara>\r
+Changes that occurred on the master branch since when the topic\r
+branch was started off it.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Limiting the diff output\r
+</term>\r
+<listitem>\r
+<literallayout>$ git diff --diff-filter=MRC            <co id="CO4-1"/>\r
+$ git diff --name-status                <co id="CO4-2"/>\r
+$ git diff arch/i386 include/asm-i386   <co id="CO4-3"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO4-1">\r
+<simpara>\r
+Show only modification, rename and copy, but not addition\r
+nor deletion.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-2">\r
+<simpara>\r
+Show only names and the nature of change, but not actual\r
+diff output.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-3">\r
+<simpara>\r
+Limit diff output to named subtrees.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Munging the diff output\r
+</term>\r
+<listitem>\r
+<literallayout>$ git diff --find-copies-harder -B -C  <co id="CO5-1"/>\r
+$ git diff -R                          <co id="CO5-2"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO5-1">\r
+<simpara>\r
+Spend extra cycles to find renames, copies and complete\r
+rewrites (very expensive).\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-2">\r
+<simpara>\r
+Output diff in reverse.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+</simplesect>\r
+<simplesect id="_author">\r
+<title>Author</title>\r
+<simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;</simpara>\r
+</simplesect>\r
+<simplesect id="_documentation">\r
+<title>Documentation</title>\r
+<simpara>Documentation by Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
+</simplesect>\r
+<simplesect id="_git">\r
+<title>GIT</title>\r
+<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
+</simplesect>\r
+</article>\r