Skip to content

Commit 78b76d3

Browse files
Martin Ågrengitster
authored andcommitted
git-diff.txt: reorder possible usages
The description of `git diff` goes through several different invocations (numbering added by me): 1. git diff [<options>] [--] [<path>...] 2. git diff [<options>] --no-index [--] <path> <path> 3. git diff [<options>] --cached [<commit>] [--] [<path>...] 4. git diff [<options>] <commit> [--] [<path>...] 5. git diff [<options>] <commit> <commit> [--] [<path>...] 6. git diff [<options>] <commit>..<commit> [--] [<path>...] 7. git diff [<options>] <commit> <commit>... <commit> [--] [<path>...] 8. git diff [<options>] <commit>...<commit> [--] [<path>...] It then goes on to say that "all of the <commit> in the above description, except in the last two forms that use '..' notations, can be any <tree>". The "last two" actually refers to 6 and 8. This got out of sync in commit b7e10b2 ("Documentation: usage for diff combined commits", 2020-06-12) which added item 7 to the mix. As a further complication, after b7e10b2 we also have some potential confusion around "the '..' notation". The "..[.]" in items 6 and 8 are part of the rev notation, whereas the "..." in item 7 is manpage language for "one or more". Move item 6 down, i.e., to between 7 and 8, to restore the ordering. Because 6 refers to 5 ("synonymous to the previous form") we need to tweak the language a bit. An added bonus of this commit is that we're trying to steer users away from `git diff <commit>..<commit>` and moving it further down probably doesn't hurt. Signed-off-by: Martin Ågren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc5482e commit 78b76d3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Documentation/git-diff.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ files on disk.
6363
This is to view the changes between two arbitrary
6464
<commit>.
6565

66-
'git diff' [<options>] <commit>..<commit> [--] [<path>...]::
67-
68-
This is synonymous to the previous form. If <commit> on
69-
one side is omitted, it will have the same effect as
70-
using HEAD instead.
71-
7266
'git diff' [<options>] <commit> <commit>... <commit> [--] [<path>...]::
7367

7468
This form is to view the results of a merge commit. The first
@@ -78,6 +72,13 @@ files on disk.
7872
For instance, if `master` names a merge commit, `git diff master
7973
master^@` gives the same combined diff as `git show master`.
8074

75+
'git diff' [<options>] <commit>..<commit> [--] [<path>...]::
76+
77+
This is synonymous to the earlier form (without the "..") for
78+
viewing the changes between two arbitrary <commit>. If <commit> on
79+
one side is omitted, it will have the same effect as
80+
using HEAD instead.
81+
8182
'git diff' [<options>] <commit>\...<commit> [--] [<path>...]::
8283

8384
This form is to view the changes on the branch containing

0 commit comments

Comments
 (0)