All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Julia Evans via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  "D. Ben Knoble" <ben.knoble@gmail.com>,
	 Julia Evans <julia@jvns.ca>
Subject: Re: [PATCH v2] doc: git-diff: rewrite EXAMPLES section
Date: Thu, 05 Nov 2026 11:46:10 -0800	[thread overview]
Message-ID: <xmqq33tft62l.fsf@gitster.g> (raw)
In-Reply-To: <pull.2293.v2.git.1793893217889.gitgitgadget@gmail.com> (Julia Evans via GitGitGadget's message of "Thu, 05 Nov 2026 15:40:17 +0000")

"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Julia Evans <julia@jvns.ca>
>
> The top piece of feedback users always give about man pages is always
> that they want better examples that are relevant to them.

I'll add this squashable fix-up on top before queuing; the change to
the code is because otherwise this change would break a test.

Thanks.


 Documentation/git-diff.adoc | 8 ++++----
 builtin/diff.c              | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git c/Documentation/git-diff.adoc w/Documentation/git-diff.adoc
index f15e56633e..42360f9b5e 100644
--- c/Documentation/git-diff.adoc
+++ w/Documentation/git-diff.adoc
@@ -10,7 +10,7 @@ SYNOPSIS
 --------
 [synopsis]
 git diff [<options>] [<commit>] [--] [<path>...]
-git diff [<options>] --staged [--merge-base] [<commit>] [--] [<path>...]
+git diff [<options>] (--cached|--staged) [--merge-base] [<commit>] [--] [<path>...]
 git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
 git diff [<options>] <commit>...<commit> [--] [<path>...]
 git diff [<options>] <blob> <blob>
@@ -47,7 +47,7 @@ to diff.
 	difference. All such pathspecs must be relative as they
 	apply to both sides of the diff.
 
-`git diff [<options>] --staged [--merge-base] [<commit>] [--] [<path>...]`::
+`git diff [<options>] (--cached|--staged) [--merge-base] [<commit>] [--] [<path>...]`::
 
 	This form is to view the changes you staged for the next
 	commit relative to the named _<commit>_.  Typically you
@@ -55,10 +55,10 @@ to diff.
 	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.
-	`--cached` is a synonym of `--staged`.
+	`--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
+of _<commit>_ and `HEAD`.  `git diff --staged --merge-base A` is equivalent to
 `git diff --staged $(git merge-base A HEAD)`.
 
 `git diff [<options>] [--merge-base] <commit> [--] [<path>...]`::
diff --git c/builtin/diff.c w/builtin/diff.c
index 18b1083e98..13fe8a21e0 100644
--- c/builtin/diff.c
+++ w/builtin/diff.c
@@ -31,7 +31,7 @@
 
 static const char builtin_diff_usage[] =
 "git diff [<options>] [<commit>] [--] [<path>...]\n"
-"   or: git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]\n"
+"   or: git diff [<options>] (--cached|--staged) [--merge-base] [<commit>] [--] [<path>...]\n"
 "   or: git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]\n"
 "   or: git diff [<options>] <commit>...<commit> [--] [<path>...]\n"
 "   or: git diff [<options>] <blob> <blob>\n"

      parent reply	other threads:[~2026-11-05 19:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 15:33 [PATCH] doc: git-diff: rewrite EXAMPLES section Julia Evans via GitGitGadget
2026-11-03 17:16 ` Julia Evans
2026-11-03 19:44 ` Junio C Hamano
2026-11-03 19:52   ` Julia Evans
2026-11-03 20:33     ` Junio C Hamano
2026-11-03 20:45       ` Julia Evans
2026-11-03 21:42         ` Junio C Hamano
2026-11-05 15:40 ` [PATCH v2] " Julia Evans via GitGitGadget
2026-11-05 16:46   ` Junio C Hamano
2026-11-05 18:18     ` Junio C Hamano
2026-11-05 17:23   ` Tuomas Ahola
2026-11-05 19:45     ` Junio C Hamano
2026-11-05 19:46   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq33tft62l.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=julia@jvns.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.