Documentation / git-diff.txton commit Merge git://git.kernel.org/pub/scm/gitk/gitk (9086a18)
   1git-diff(1)
   2===========
   3
   4NAME
   5----
   6git-diff - Show changes between commits, commit and working tree, etc
   7
   8
   9SYNOPSIS
  10--------
  11'git-diff' [ --diff-options ] <ent>{0,2} [<path>...]
  12
  13DESCRIPTION
  14-----------
  15Show changes between two ents, an ent and the working tree, an
  16ent and the index file, or the index file and the working tree.
  17The combination of what is compared with what is determined by
  18the number of ents given to the command.
  19
  20* When no <ent> is given, the working tree and the index
  21  file is compared, using `git-diff-files`.
  22
  23* When one <ent> is given, the working tree and the named
  24  tree is compared, using `git-diff-index`.  The option
  25  `--cached` can be given to compare the index file and
  26  the named tree.
  27
  28* When two <ent>s are given, these two trees are compared
  29  using `git-diff-tree`.
  30
  31OPTIONS
  32-------
  33--diff-options::
  34        '--diff-options' are passed to the `git-diff-files`,
  35        `git-diff-index`, and `git-diff-tree` commands.  See the
  36        documentation for these commands for description.
  37
  38<path>...::
  39        The <path> arguments are also passed to `git-diff-\*`
  40        commands.
  41
  42
  43EXAMPLES
  44--------
  45
  46Various ways to check your working tree::
  47+
  48------------
  49$ git diff <1>
  50$ git diff --cached <2>
  51$ git diff HEAD <3>
  52
  53<1> changes in the working tree since your last git-update-index.
  54<2> changes between the index and your last commit; what you
  55would be committing if you run "git commit" without "-a" option.
  56<3> changes in the working tree since your last commit; what you
  57would be committing if you run "git commit -a"
  58------------
  59
  60Comparing with arbitrary commits::
  61+
  62------------
  63$ git diff test <1>
  64$ git diff HEAD -- ./test <2>
  65$ git diff HEAD^ HEAD <3>
  66
  67<1> instead of using the tip of the current branch, compare with the
  68tip of "test" branch.
  69<2> instead of comparing with the tip of "test" branch, compare with
  70the tip of the current branch, but limit the comparison to the
  71file "test".
  72<3> compare the version before the last commit and the last commit.
  73------------
  74
  75
  76Limiting the diff output::
  77+
  78------------
  79$ git diff --diff-filter=MRC <1>
  80$ git diff --name-status -r <2>
  81$ git diff arch/i386 include/asm-i386 <3>
  82
  83<1> show only modification, rename and copy, but not addition
  84nor deletion.
  85<2> show only names and the nature of change, but not actual
  86diff output.  --name-status disables usual patch generation
  87which in turn also disables recursive behaviour, so without -r
  88you would only see the directory name if there is a change in a
  89file in a subdirectory.
  90<3> limit diff output to named subtrees.
  91------------
  92
  93Munging the diff output::
  94+
  95------------
  96$ git diff --find-copies-harder -B -C <1>
  97$ git diff -R <2>
  98
  99<1> spend extra cycles to find renames, copies and complete
 100rewrites (very expensive).
 101<2> output diff in reverse.
 102------------
 103
 104
 105Author
 106------
 107Written by Linus Torvalds <torvalds@osdl.org>
 108
 109Documentation
 110--------------
 111Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
 112
 113GIT
 114---
 115Part of the gitlink:git[7] suite
 116