Thread (18 messages) 18 messages, 3 authors, 2020-06-12
STALE2222d
Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH 3/3] Documentation: tweak git diff help slightly

From: Chris Torek via GitGitGadget <hidden>
Date: 2020-06-09 00:04:13
Subsystem: documentation, the rest · Maintainers: Jonathan Corbet, Linus Torvalds

From: Chris Torek <redacted>

Update the manual page synopsis to include the two and three
dot notation.

Make "git diff -h" print the same usage summary as the manual
page synopsis.

Signed-off-by: Chris Torek <redacted>
---
 Documentation/git-diff.txt | 2 ++
 builtin/diff.c             | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index 37781cf1755..c6a201abd72 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -12,6 +12,8 @@ SYNOPSIS
 'git diff' [<options>] [<commit>] [--] [<path>...]
 'git diff' [<options>] --cached [<commit>] [--] [<path>...]
 'git diff' [<options>] <commit> <commit> [--] [<path>...]
+'git diff' [<options>] <commit>..<commit> [--] [<path>...]
+'git diff' [<options>] <commit>...<commit> [--] [<path>...]
 'git diff' [<options>] <blob> <blob>
 'git diff' [<options>] --no-index [--] <path> <path>
 
diff --git a/builtin/diff.c b/builtin/diff.c
index 8b8b95ec97e..365f9e9a908 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -24,7 +24,14 @@
 #define DIFF_NO_INDEX_IMPLICIT 2
 
 static const char builtin_diff_usage[] =
-"git diff [<options>] [<commit> [<commit>]] [--] [<path>...]";
+"git diff [<options>] [<commit>] [--] [<path>...]\n"
+"   or: git diff [<options>] --cached [<commit>] [--] [<path>...]\n"
+"   or: git diff [<options>] <commit> <commit>] [--] [<path>...]\n"
+"   or: git diff [<options>] <commit>..<commit>] [--] [<path>...]\n"
+"   or: git diff [<options>] <commit>...<commit>] [--] [<path>...]\n"
+"   or: git diff [<options>] <blob> <blob>]\n"
+"   or: git diff [<options>] --no-index [--] <path> <path>]\n"
+COMMON_DIFF_OPTIONS_HELP;
 
 static const char *blob_path(struct object_array_entry *entry)
 {
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help