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

Re: git alias and --help

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2011, 22:50 UTC
Message-ID
<7v8vo6xd4u.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vfwiexe6m.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> Gelonida N <gelonida@gmail.com> writes:
>
>> Is there any trick to get the help text of git branch without
>> having to type
>>
>> git branch --help
>
> How about "git help branch"?

It was bad of me to write a tongue-in-cheek answer, get distracted and ended up sending it without the real answer.

The reason why we do not do what you seem to be suggesting is because giving the same behaviour to "git b --help" as "git branch --help" is wrong.

To see why, imagine you have configured an alias that is not a simple and stupid substitution "b == branch", but something like "bt == branch -t", and then want to know what you should write after "git bt". Giving the manpage for branch without giving them any hint that they configured that alias to produce customized behaviour that is different from plain vanilla "branch" is not quite acceptable.

I think you _could_ make a patch that special cases a simple and straight substitution and skip the "foo is aliased to bar" step, but I doubt it is worth it to lose consistency between "git b --help" vs "git bt --help" that way.

Previous: Junio C HamanoNext: Gelonida N
Message 3 of 14 in “git alias and --help”
  1. Gelonida NOct 27, 2011
  2. Junio C HamanoOct 27, 2011
  3. Junio C HamanoOct 27, 2011
  4. Gelonida NOct 28, 2011
  5. Miles BaderOct 28, 2011
  6. Junio C HamanoOct 28, 2011
  7. Michael J GruberOct 28, 2011
  8. Gelonida NOct 28, 2011
  9. Jakub NarebskiOct 28, 2011
  10. Gelonida NOct 28, 2011
  11. Jakub NarebskiOct 28, 2011
  12. Junio C HamanoOct 28, 2011
  13. Miles BaderOct 28, 2011
  14. Gelonida NOct 28, 2011

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.