<h2>DESCRIPTION</h2>\r
<div class="sectionbody">\r
<p>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.\r
-The combination of what is compared with what is determined by\r
-the number of trees given to the command.</p>\r
-<ul>\r
-<li>\r
+tree and the index file, or the index file and the working tree.</p>\r
+<dl>\r
+<dt>\r
+<em>git-diff</em> [--options] [--] [<path>…]\r
+</dt>\r
+<dd>\r
<p>\r
-When no <tree-ish> is given, the working tree and the index\r
- file are compared, using <tt>git-diff-files</tt>.\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 _could_ tell git to\r
+ further add to the index but you still haven't. You can\r
+ stage these changes by using <a href="git-add.html">git-add(1)</a>.\r
</p>\r
-</li>\r
-<li>\r
+</dd>\r
+<dt>\r
+<em>git-diff</em> [--options] --cached [<commit>] [--] [<path>…]\r
+</dt>\r
+<dd>\r
<p>\r
-When one <tree-ish> is given, the working tree and the named\r
- tree are compared, using <tt>git-diff-index</tt>. The option\r
- <tt>--index</tt> can be given to compare the index file and\r
- the named tree.\r
- <tt>--cached</tt> is a deprecated alias for <tt>--index</tt>. It's use is\r
- discouraged.\r
+ This form is to view the changes you staged for the next\r
+ commit relative to the named <tree-ish>. Typically you\r
+ would want comparison with the latest commit, so if you\r
+ do not give <commit>, it defaults to HEAD.\r
</p>\r
-</li>\r
-<li>\r
+</dd>\r
+<dt>\r
+<em>git-diff</em> [--options] <commit> — [<path>…]\r
+</dt>\r
+<dd>\r
<p>\r
-When two <tree-ish>s are given, these two trees are compared\r
- using <tt>git-diff-tree</tt>.\r
+ This form is to view the changes you have in your\r
+ working tree relative to the named <commit>. 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
</p>\r
-</li>\r
-</ul>\r
+</dd>\r
+<dt>\r
+<em>git-diff</em> [--options] <commit> <commit> — [<path>…]\r
+</dt>\r
+<dd>\r
+<p>\r
+ This form is to view the changes between two <commit>,\r
+ for example, tips of two branches.\r
+</p>\r
+</dd>\r
+</dl>\r
+<p>Just in case if you are doing something exotic, it should be\r
+noted that all of the <commit> in the above description can be\r
+any <tree-ish>.</p>\r
</div>\r
<h2>OPTIONS</h2>\r
<div class="sectionbody">\r
<dl>\r
<dt>\r
---diff-options\r
+-p\r
+</dt>\r
+<dd>\r
+<p>\r
+ Generate patch (see section on generating patches)\r
+</p>\r
+</dd>\r
+<dt>\r
+-u\r
+</dt>\r
+<dd>\r
+<p>\r
+ Synonym for "-p".\r
+</p>\r
+</dd>\r
+<dt>\r
+--raw\r
+</dt>\r
+<dd>\r
+<p>\r
+ Generate the raw format.\r
+</p>\r
+</dd>\r
+<dt>\r
+--patch-with-raw\r
+</dt>\r
+<dd>\r
+<p>\r
+ Synonym for "-p --raw".\r
+</p>\r
+</dd>\r
+<dt>\r
+--stat[=width[,name-width]]\r
+</dt>\r
+<dd>\r
+<p>\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
+</p>\r
+</dd>\r
+<dt>\r
+--numstat\r
+</dt>\r
+<dd>\r
+<p>\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.\r
+</p>\r
+</dd>\r
+<dt>\r
+--summary\r
+</dt>\r
+<dd>\r
+<p>\r
+ Output a condensed summary of extended header information\r
+ such as creations, renames and mode changes.\r
+</p>\r
+</dd>\r
+<dt>\r
+--patch-with-stat\r
+</dt>\r
+<dd>\r
+<p>\r
+ Synonym for "-p --stat".\r
+</p>\r
+</dd>\r
+<dt>\r
+-z\r
+</dt>\r
+<dd>\r
+<p>\r
+ \0 line termination on output\r
+</p>\r
+</dd>\r
+<dt>\r
+--name-only\r
+</dt>\r
+<dd>\r
+<p>\r
+ Show only names of changed files.\r
+</p>\r
+</dd>\r
+<dt>\r
+--name-status\r
+</dt>\r
+<dd>\r
+<p>\r
+ Show only names and status of changed files.\r
+</p>\r
+</dd>\r
+<dt>\r
+--color\r
+</dt>\r
+<dd>\r
+<p>\r
+ Show colored diff.\r
+</p>\r
+</dd>\r
+<dt>\r
+--no-color\r
+</dt>\r
+<dd>\r
+<p>\r
+ Turn off colored diff, even when the configuration file\r
+ gives the default to color output.\r
+</p>\r
+</dd>\r
+<dt>\r
+--color-words\r
+</dt>\r
+<dd>\r
+<p>\r
+ Show colored word diff, i.e. color words which have changed.\r
+</p>\r
+</dd>\r
+<dt>\r
+--no-renames\r
+</dt>\r
+<dd>\r
+<p>\r
+ Turn off rename detection, even when the configuration\r
+ file gives the default to do so.\r
+</p>\r
+</dd>\r
+<dt>\r
+--full-index\r
</dt>\r
<dd>\r
<p>\r
- <em>--diff-options</em> are passed to the <tt>git-diff-files</tt>,\r
- <tt>git-diff-index</tt>, and <tt>git-diff-tree</tt> commands. See the\r
- documentation for these commands for description.\r
+ Instead of the first handful characters, show full\r
+ object name of pre- and post-image blob on the "index"\r
+ line when generating a patch format output.\r
</p>\r
</dd>\r
<dt>\r
+--binary\r
+</dt>\r
+<dd>\r
+<p>\r
+ In addition to --full-index, output "binary diff" that\r
+ can be applied with "git apply".\r
+</p>\r
+</dd>\r
+<dt>\r
+--abbrev[=<n>]\r
+</dt>\r
+<dd>\r
+<p>\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 handful hexdigits 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=<n>.\r
+</p>\r
+</dd>\r
+<dt>\r
+-B\r
+</dt>\r
+<dd>\r
+<p>\r
+ Break complete rewrite changes into pairs of delete and create.\r
+</p>\r
+</dd>\r
+<dt>\r
+-M\r
+</dt>\r
+<dd>\r
+<p>\r
+ Detect renames.\r
+</p>\r
+</dd>\r
+<dt>\r
+-C\r
+</dt>\r
+<dd>\r
+<p>\r
+ Detect copies as well as renames.\r
+</p>\r
+</dd>\r
+<dt>\r
+--diff-filter=[ACDMRTUXB*]\r
+</dt>\r
+<dd>\r
+<p>\r
+ Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),\r
+ Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their\r
+ type (mode) changed (<tt>T</tt>), are Unmerged (<tt>U</tt>), are\r
+ Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).\r
+ Any combination of the filter characters may be used.\r
+ When <tt>*</tt> (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
+</p>\r
+</dd>\r
+<dt>\r
+--find-copies-harder\r
+</dt>\r
+<dd>\r
+<p>\r
+ For performance reasons, by default, -C 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.\r
+</p>\r
+</dd>\r
+<dt>\r
+-l<num>\r
+</dt>\r
+<dd>\r
+<p>\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
+</p>\r
+</dd>\r
+<dt>\r
+-S<string>\r
+</dt>\r
+<dd>\r
+<p>\r
+ Look for differences that contain the change in <string>.\r
+</p>\r
+</dd>\r
+<dt>\r
+--pickaxe-all\r
+</dt>\r
+<dd>\r
+<p>\r
+ When -S finds a change, show all the changes in that\r
+ changeset, not just the files that contain the change\r
+ in <string>.\r
+</p>\r
+</dd>\r
+<dt>\r
+--pickaxe-regex\r
+</dt>\r
+<dd>\r
+<p>\r
+ Make the <string> not a plain string but an extended POSIX\r
+ regex to match.\r
+</p>\r
+</dd>\r
+<dt>\r
+-O<orderfile>\r
+</dt>\r
+<dd>\r
+<p>\r
+ Output the patch in the order specified in the\r
+ <orderfile>, which has one shell glob pattern per line.\r
+</p>\r
+</dd>\r
+<dt>\r
+-R\r
+</dt>\r
+<dd>\r
+<p>\r
+ Swap two inputs; that is, show differences from index or\r
+ on-disk file to tree contents.\r
+</p>\r
+</dd>\r
+<dt>\r
+--text\r
+</dt>\r
+<dd>\r
+<p>\r
+ Treat all files as text.\r
+</p>\r
+</dd>\r
+<dt>\r
+-a\r
+</dt>\r
+<dd>\r
+<p>\r
+ Shorthand for "--text".\r
+</p>\r
+</dd>\r
+<dt>\r
+--ignore-space-change\r
+</dt>\r
+<dd>\r
+<p>\r
+ Ignore changes in amount of white space. This ignores white\r
+ space at line end, and consider all other sequences of one or\r
+ more white space characters to be equivalent.\r
+</p>\r
+</dd>\r
+<dt>\r
+-b\r
+</dt>\r
+<dd>\r
+<p>\r
+ Shorthand for "--ignore-space-change".\r
+</p>\r
+</dd>\r
+<dt>\r
+--ignore-all-space\r
+</dt>\r
+<dd>\r
+<p>\r
+ Ignore white space when comparing lines. This ignores\r
+ difference even if one line has white space where the other\r
+ line has none.\r
+</p>\r
+</dd>\r
+<dt>\r
+-w\r
+</dt>\r
+<dd>\r
+<p>\r
+ Shorthand for "--ignore-all-space".\r
+</p>\r
+</dd>\r
+</dl>\r
+<p>For more detailed explanation on these common options, see also\r
+<a href="diffcore.html">diffcore documentation</a>.</p>\r
+<dl>\r
+<dt>\r
<path>…\r
</dt>\r
<dd>\r
<p>\r
- The <path> arguments are also passed to <tt>git-diff-*</tt>\r
- commands.\r
+ The <paths> 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
</p>\r
</dd>\r
</dl>\r
<div class="listingblock">\r
<div class="content">\r
<pre><tt>$ git diff <b>(1)</b>\r
-$ git diff --index <b>(2)</b>\r
+$ git diff --cached <b>(2)</b>\r
$ git diff HEAD <b>(3)</b></tt></pre>\r
</div></div>\r
<ol>\r
<li>\r
<p>\r
-changes in the working tree since your last git-update-index.\r
+changes in the working tree not yet staged for the next commit.\r
</p>\r
</li>\r
<li>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 03-Dec-2006 01:53:20 UTC\r
+Last updated 14-Dec-2006 11:19:59 UTC\r
</div>\r
</div>\r
</body>\r
-----------
Show changes between two trees, a tree and the working tree, a
tree and the index file, or the index file and the working tree.
-The combination of what is compared with what is determined by
-the number of trees given to the command.
-* When no <tree-ish> is given, the working tree and the index
- file are compared, using `git-diff-files`.
+'git-diff' [--options] [--] [<path>...]::
-* When one <tree-ish> is given, the working tree and the named
- tree are compared, using `git-diff-index`. The option
- `--index` can be given to compare the index file and
- the named tree.
- `--cached` is a deprecated alias for `--index`. It's use is
- discouraged.
+ This form is to view the changes you made relative to
+ the index (staging area for the next commit). In other
+ words, the differences are what you _could_ tell git to
+ further add to the index but you still haven't. You can
+ stage these changes by using gitlink:git-add[1].
+
+'git-diff' [--options] --cached [<commit>] [--] [<path>...]::
+
+ This form is to view the changes you staged for the next
+ commit relative to the named <tree-ish>. Typically you
+ would want comparison with the latest commit, so if you
+ do not give <commit>, it defaults to HEAD.
+
+'git-diff' [--options] <commit> -- [<path>...]::
+
+ This form is to view the changes you have in your
+ working tree relative to the named <commit>. You can
+ use HEAD to compare it with the latest commit, or a
+ branch name to compare with the tip of a different
+ branch.
+
+'git-diff' [--options] <commit> <commit> -- [<path>...]::
+
+ This form is to view the changes between two <commit>,
+ for example, tips of two branches.
+
+Just in case if you are doing something exotic, it should be
+noted that all of the <commit> in the above description can be
+any <tree-ish>.
-* When two <tree-ish>s are given, these two trees are compared
- using `git-diff-tree`.
OPTIONS
-------
---diff-options::
- '--diff-options' are passed to the `git-diff-files`,
- `git-diff-index`, and `git-diff-tree` commands. See the
- documentation for these commands for description.
+include::diff-options.txt[]
<path>...::
- The <path> arguments are also passed to `git-diff-\*`
- commands.
+ The <paths> parameters, when given, are used to limit
+ the diff to the named paths (you can give directory
+ names and get diff for all files under them).
EXAMPLES
+
------------
$ git diff <1>
-$ git diff --index <2>
+$ git diff --cached <2>
$ git diff HEAD <3>
------------
+
-<1> changes in the working tree since your last git-update-index.
+<1> changes in the working tree not yet staged for the next commit.
<2> changes between the index and your last commit; what you
would be committing if you run "git commit" without "-a" option.
<3> changes in the working tree since your last commit; what you