@@ -10,8 +10,8 @@ SYNOPSIS
1010--------
1111[verse]
1212'git diff' [<options>] [<commit>] [--] [<path>...]
13- 'git diff' [<options>] --cached [<commit>] [--] [<path>...]
14- 'git diff' [<options>] <commit> [<commit>...] <commit> [--] [<path>...]
13+ 'git diff' [<options>] --cached [--merge-base] [ <commit>] [--] [<path>...]
14+ 'git diff' [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
1515'git diff' [<options>] <commit>...<commit> [--] [<path>...]
1616'git diff' [<options>] <blob> <blob>
1717'git diff' [<options>] --no-index [--] <path> <path>
@@ -40,7 +40,7 @@ files on disk.
4040 or when running the command outside a working tree
4141 controlled by Git. This form implies `--exit-code`.
4242
43- 'git diff' [<options>] --cached [<commit>] [--] [<path>...]::
43+ 'git diff' [<options>] --cached [--merge-base] [ <commit>] [--] [<path>...]::
4444
4545 This form is to view the changes you staged for the next
4646 commit relative to the named <commit>. Typically you
@@ -49,6 +49,10 @@ files on disk.
4949 If HEAD does not exist (e.g. unborn branches) and
5050 <commit> is not given, it shows all staged changes.
5151 --staged is a synonym of --cached.
52+ +
53+ If --merge-base is given, instead of using <commit>, use the merge base
54+ of <commit> and HEAD. `git diff --merge-base A` is equivalent to
55+ `git diff $(git merge-base A HEAD)`.
5256
5357'git diff' [<options>] <commit> [--] [<path>...]::
5458
@@ -58,23 +62,27 @@ files on disk.
5862 branch name to compare with the tip of a different
5963 branch.
6064
61- 'git diff' [<options>] <commit> <commit> [--] [<path>...]::
65+ 'git diff' [<options>] [--merge-base] <commit> <commit> [--] [<path>...]::
6266
6367 This is to view the changes between two arbitrary
6468 <commit>.
69+ +
70+ If --merge-base is given, use the merge base of the two commits for the
71+ "before" side. `git diff --merge-base A B` is equivalent to
72+ `git diff $(git merge-base A B) B`.
6573
6674'git diff' [<options>] <commit> <commit>... <commit> [--] [<path>...]::
6775
6876 This form is to view the results of a merge commit. The first
6977 listed <commit> must be the merge itself; the remaining two or
7078 more commits should be its parents. A convenient way to produce
71- the desired set of revisions is to use the {caret}@ suffix.
79+ the desired set of revisions is to use the `^@` suffix.
7280 For instance, if `master` names a merge commit, `git diff master
7381 master^@` gives the same combined diff as `git show master`.
7482
7583'git diff' [<options>] <commit>..<commit> [--] [<path>...]::
7684
77- This is synonymous to the earlier form (without the ".." ) for
85+ This is synonymous to the earlier form (without the `..` ) for
7886 viewing the changes between two arbitrary <commit>. If <commit> on
7987 one side is omitted, it will have the same effect as
8088 using HEAD instead.
@@ -83,20 +91,20 @@ files on disk.
8391
8492 This form is to view the changes on the branch containing
8593 and up to the second <commit>, starting at a common ancestor
86- of both <commit>. " git diff A\ ...B" is equivalent to
87- " git diff $(git merge-base A B) B" . You can omit any one
94+ of both <commit>. ` git diff A...B` is equivalent to
95+ ` git diff $(git merge-base A B) B` . You can omit any one
8896 of <commit>, which has the same effect as using HEAD instead.
8997
9098Just in case you are doing something exotic, it should be
9199noted that all of the <commit> in the above description, except
92- in the last two forms that use ".." notations, can be any
93- <tree>.
100+ in the `--merge-base` case and in the last two forms that use `..`
101+ notations, can be any <tree>.
94102
95103For a more complete list of ways to spell <commit>, see
96104"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
97105However, "diff" is about comparing two _endpoints_, not ranges,
98- and the range notations (" <commit>..<commit>" and
99- " <commit>\ ...<commit>" ) do not mean a range as defined in the
106+ and the range notations (` <commit>..<commit>` and
107+ ` <commit>...<commit>` ) do not mean a range as defined in the
100108"SPECIFYING RANGES" section in linkgit:gitrevisions[7].
101109
102110'git diff' [<options>] <blob> <blob>::
@@ -144,9 +152,9 @@ $ git diff HEAD <3>
144152+
145153<1> Changes in the working tree not yet staged for the next commit.
146154<2> Changes between the index and your last commit; what you
147- would be committing if you run " git commit" without "-a" option.
155+ would be committing if you run ` git commit` without `-a` option.
148156<3> Changes in the working tree since your last commit; what you
149- would be committing if you run " git commit -a"
157+ would be committing if you run ` git commit -a`
150158
151159Comparing with arbitrary commits::
152160+
0 commit comments