git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] ls-remote: don't use '-h' for options

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 27, 2020, 16:10 UTC
Message-ID
<xmqqa754gger.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<03985e4099e82f04709d5ea9ca2a56a6@pascalroeleven.nl>
Pascal Roeleven <dev@pascalroeleven.nl> writes:
> In my case I looked into the documentation, used '-h' exactly as
> described ('<refs>' is optional) and it didn't produce the output as
> described. If you ask me, either the code or the documentation should
> be changed.
Yeah, I tend to agree that documentation could be better.  

You may think that nobody would ask your opinion, but proposing a change by sending a patch often makes you heard around here ;-)

Thanks.
-- >8 --
Subject: [PATCH] Documentation: clarify that `-h` alone stands for `help`

We seem to be getting new users who get confused every 20 months or so with this "-h consistently wants to give help, but the commands to which `-h` may feel like a good short-form option want it to mean something else." compromise.

Let's make sure that the readers know that `git cmd -h` (with no other arguments) is a way to get usage text, even for commands like ls-remote and grep.

Also extend the description that is already in gitcli.txt, as it is clear that users still get confused with the current text.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-ls-remote.txt | 4 +++-
 Documentation/gitcli.txt        | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index a2ea1fd687..0a5c8b7d49 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -28,7 +28,9 @@ OPTIONS
 	Limit to only refs/heads and refs/tags, respectively.
 	These options are _not_ mutually exclusive; when given
 	both, references stored in refs/heads and refs/tags are
-	displayed.
+	displayed.  Note that `git ls-remote -h` used without
+	anything else on the command line gives help, consistent
+	with other git subcommands.
 
 --refs::
 	Do not show peeled tags or pseudorefs like `HEAD` in the output.
diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt
index 373cfa2264..92e4ba6a2f 100644
--- a/Documentation/gitcli.txt
+++ b/Documentation/gitcli.txt
@@ -126,6 +126,11 @@ usage: git describe [<options>] <commit-ish>*
     --long                always use long format
     --abbrev[=<n>]        use <n> digits to display SHA-1s
 ---------------------------------------------
++
+Note that some subcommand (e.g. `git grep`) may behave differently
+when there are things on the command line other than `-h`, but `git
+subcmd -h` without anything else on the command line is meant to
+consistently give the usage.
 
 --help-all::
 	Some Git commands take options that are only used for plumbing or that
Previous: Pascal RoelevenNext: Pascal Roeleven
Message 4 of 6 in “ls-remote: don't use '-h' for options”
  1. 1/1 ls-remote: don't use '-h' for optionsdev@pascalroeleven.nl, Feb 27, 2020
  2. Danh DoanFeb 27, 2020
  3. Pascal RoelevenFeb 27, 2020
  4. Junio C HamanoFeb 27, 2020
  5. Pascal RoelevenFeb 27, 2020
  6. Junio C HamanoFeb 27, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.