Skip to content

Commit b7e10b2

Browse files
chris3torekgitster
authored andcommitted
Documentation: usage for diff combined commits
Document the usage for producing combined commits with "git diff". This includes updating the synopsis section. While here, add the three-dot notation to the synopsis. Make "git diff -h" print the same usage summary as the manual page synopsis, minus the "A..B" form, which is now discouraged. Signed-off-by: Chris Torek <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8bfcb3a commit b7e10b2

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

Documentation/git-diff.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ SYNOPSIS
1111
[verse]
1212
'git diff' [<options>] [<commit>] [--] [<path>...]
1313
'git diff' [<options>] --cached [<commit>] [--] [<path>...]
14-
'git diff' [<options>] <commit> <commit> [--] [<path>...]
14+
'git diff' [<options>] <commit> [<commit>...] <commit> [--] [<path>...]
15+
'git diff' [<options>] <commit>...<commit> [--] [<path>...]
1516
'git diff' [<options>] <blob> <blob>
1617
'git diff' [<options>] --no-index [--] <path> <path>
1718

1819
DESCRIPTION
1920
-----------
2021
Show changes between the working tree and the index or a tree, changes
21-
between the index and a tree, changes between two trees, changes between
22-
two blob objects, or changes between two files on disk.
22+
between the index and a tree, changes between two trees, changes resulting
23+
from a merge, changes between two blob objects, or changes between two
24+
files on disk.
2325

2426
'git diff' [<options>] [--] [<path>...]::
2527

@@ -67,6 +69,15 @@ two blob objects, or changes between two files on disk.
6769
one side is omitted, it will have the same effect as
6870
using HEAD instead.
6971

72+
'git diff' [<options>] <commit> [<commit>...] <commit> [--] [<path>...]::
73+
74+
This form is to view the results of a merge commit. The first
75+
listed <commit> must be the merge itself; the remaining two or
76+
more commits should be its parents. A convenient way to produce
77+
the desired set of revisions is to use the {caret}@ suffix.
78+
For instance, if `master` names a merge commit, `git diff master
79+
master^@` gives the same combined diff as `git show master`.
80+
7081
'git diff' [<options>] <commit>\...<commit> [--] [<path>...]::
7182

7283
This form is to view the changes on the branch containing
@@ -196,7 +207,8 @@ linkgit:git-difftool[1],
196207
linkgit:git-log[1],
197208
linkgit:gitdiffcore[7],
198209
linkgit:git-format-patch[1],
199-
linkgit:git-apply[1]
210+
linkgit:git-apply[1],
211+
linkgit:git-show[1]
200212

201213
GIT
202214
---

builtin/diff.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
#define DIFF_NO_INDEX_IMPLICIT 2
2525

2626
static const char builtin_diff_usage[] =
27-
"git diff [<options>] [<commit> [<commit>]] [--] [<path>...]";
27+
"git diff [<options>] [<commit>] [--] [<path>...]\n"
28+
" or: git diff [<options>] --cached [<commit>] [--] [<path>...]\n"
29+
" or: git diff [<options>] <commit> [<commit>...] <commit> [--] [<path>...]\n"
30+
" or: git diff [<options>] <commit>...<commit>] [--] [<path>...]\n"
31+
" or: git diff [<options>] <blob> <blob>]\n"
32+
" or: git diff [<options>] --no-index [--] <path> <path>]\n"
33+
COMMON_DIFF_OPTIONS_HELP;
2834

2935
static const char *blob_path(struct object_array_entry *entry)
3036
{

0 commit comments

Comments
 (0)