Nicolas Pitre <nico@xxxxxxx> writes: > On Fri, 14 Apr 2006, Junio C Hamano wrote: > >> Nicolas Pitre <nico@xxxxxxx> 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() - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html