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

Re: git log is a bit antisocial

From
Junio C Hamano <junkio@cox.net>
Date
Apr 14, 2006, 21:28 UTC
Message-ID
<7vhd4vq23h.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0604141719290.2215@localhost.localdomain>
Nicolas Pitre <nico@cam.org> writes:
Show 14 quoted lines
> On Fri, 14 Apr 2006, Junio C Hamano wrote:
>
>> Nicolas Pitre <nico@cam.org> writes:
>> 
>> > $  git log -h
>> > fatal: unrecognized argument: -h
>> > $ git log --help
>> > fatal: unrecognized argument: --help
>> >
>> > Maybe the usage string could be printed in those cases?
>> 
>> Perhaps.  Alternatively, "git help log", perhaps.
>
> What about git-log then?
What about it?

Asking for help on log could be spelled as "git log --help" with a patch like the attached, but I am not sure that is worth it...

-- >8 --
diff --git a/git.c b/git.c
index 78ed403..7fdacdd 100644
--- a/git.c
+++ b/git.c
@@ -497,6 +497,16 @@ int main(int argc, const char **argv, ch
 	}
 	argv[0] = cmd;
 
+	/* It could be git blah --help or git boo -h, but be
+	 * careful; most commands have their own '-h' and '--help'.
+	 */
+	if (argc == 2 &&
+	    (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
+		argv[0] = "help";
+		argv[1] = cmd;
+		exit(cmd_help(1, argv, envp));
+	}
+
 	/*
 	 * We search for git commands in the following order:
 	 *  - git_exec_path()
Previous: Nicolas PitreNext: Sébastien Pierre
Message 4 of 8 in “git log is a bit antisocial”
  1. Nicolas PitreApr 14, 2006
  2. Junio C HamanoApr 14, 2006
  3. Nicolas PitreApr 14, 2006
  4. Junio C HamanoApr 14, 2006
  5. Sébastien PierreApr 14, 2006
  6. Junio C HamanoApr 14, 2006
  7. Sébastien PierreApr 14, 2006
  8. Junio C HamanoApr 14, 2006

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.