git-diff(1)
===========
NAME
----
git-diff - Show changes between commits, commit and working tree, etc
SYNOPSIS
--------
[synopsis]
git diff [<options>] [<commit>] [--] [<path>...]
git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]
git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
git diff [<options>] <commit>...<commit> [--] [<path>...]
git diff [<options>] <blob> <blob>
git diff [<options>] --no-index [--] <path> <path>
DESCRIPTION
-----------
Show changes between the working tree and the index or a tree, changes
between the index and a tree, changes between two trees, changes resulting
from a merge, changes between two blob objects, or changes between two
files on disk.
`git diff [<options>] [--] [<path>...]`::
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 linkgit:git-add[1].
`git diff [<options>] --no-index [--] <path> <path>`::
This form is to compare the given two paths on the
filesystem. You can omit the `--no-index` option when
running the command in a working tree controlled by Git and
at least one of the paths points outside the working tree,
or when running the command outside a working tree
controlled by Git. This form implies `--exit-code`.
`git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]`::
This form is to view the changes you staged for the next
commit relative to the named _<commit>_. Typically you
would want comparison with the latest commit, so if you
do not give _<commit>_, it defaults to `HEAD`.
If `HEAD` does not exist (e.g. unborn branches) and
_<commit>_ is not given, it shows all staged changes.
`--staged` is a synonym of `--cached`.
+
If `--merge-base` is given, instead of using _<commit>_, use the merge base
of _<commit>_ and `HEAD`. `git diff --cached --merge-base A` is equivalent to
`git diff --cached $(git merge-base A HEAD)`.
`git diff [<options>] [--merge-base] <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.
+
If `--merge-base` is given, instead of using _<commit>_, use the merge base
of _<commit>_ and `HEAD`. `git diff --merge-base A` is equivalent to
`git diff $(git merge-base A HEAD)`.
`git diff [<options>] [--merge-base] <commit> <commit> [--] [<path>...]`::
This is to view the changes between two arbitrary
_<commit>_.
+
If `--merge-base` is given, use the merge base of the two commits for the
"before" side. `git diff --merge-base A B` is equivalent to
`git diff $(git merge-base A B) B`.
`git diff [<options>] <commit> <commit>...<commit> [--] [<path>...]`::
This form is to view the results of a merge commit. The first
listed _<commit>_ must be the merge itself; the remaining two or
more commits should be its parents. Convenient ways to produce
the desired set of revisions are to use the suffixes `@` and
`^!`. If `A` is a merge commit, then `git diff A A^@`,
`git diff A^!` and `git show A` all give the same combined diff.
`git diff [<options>] <commit>..<commit> [--] [<path>...]`::
This is synonymous to the earlier form (without the `..`) for
viewing the changes between two arbitrary _<commit>_. If _<commit>_ on
one side is omitted, it will have the same effect as
using `HEAD` instead.
`git diff [<options>] <commit>...<commit> [--] [<path>...]`::
This form is to view the changes on the branch containing
and up to the second _<commit>_, starting at a common ancestor
of both _<commit>_. `git diff A...B` is equivalent to
`git diff $(git merge-base A B) B`. You can omit any one
of _<commit>_, which has the same effect as using `HEAD` instead.
Just