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

Re: git alias and --help

From
Jakub Narebski <jnareb@gmail.com>
Date
Oct 28, 2011, 13:26 UTC
Message-ID
<m362j95jv3.fsf@localhost.localdomain>
In-Reply-To
<buoty6t9937.fsf@dhlpc061.dev.necel.com>
Miles Bader <miles@gnu.org> writes:
> Junio C Hamano <gitster@pobox.com> writes:
Show 26 quoted lines
> > > > git branch --help
> > >
> > > How about "git help branch"?
> >
> > 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.
> 
> I agree with Gelonida's followup:  although what you say makes sense,
> it's still pretty annoying behavior for the very common case of a
> simple renaming alias...
> 
> E.g., I have "co" aliased to "checkout", and so my fingers are very
> very inclined to say "co" when I mean checkout... including when
> asking for help.  I actually end up typing "git co --help", grumbling,
> and retyping with the full command name, quite reguarly.
> 
> What I've often wished is that git's help system would output
> something like:
> 
>    $ git help co
>    `git co' is aliased to `checkout'
> 
>    Here's the help entry for `checkout':
> 
>    GIT-CHECKOUT(1)                   Git Manual                   GIT-CHECKOUT(1)
Wouldn't it be more useful to say something like this:
  $ git co --help
  `git co' is aliased to `checkout'
 
  You can see help entry for `checkout' with "git checkout --help"
Then help is only copy'n'paste away.  

(This helping text probably should be controlled by some advice.* config variable).

P.S. I wonder if allowing to run command if you specify unambiguous prefix would be a good replacement for such aliases?

-- 
Jakub Narębski
Previous: Gelonida NNext: Junio C Hamano
Message 11 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.