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

Re: git alias and --help

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 28, 2011, 09:00 UTC
Message-ID
<4EAA6F2F.5020301@drmicha.warpmail.net>
In-Reply-To
<7vvcr9wyje.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 28.10.2011 06:05:
Show 13 quoted lines
> Miles Bader <miles@gnu.org> writes:
> 
>> Of course, that would be the wrong thing for somebody that just wants
>> to be reminded what an alias expands too, but my intuition is that
>> this is a very tiny minority compared to people that want to examine
>> the options for the underlying command...
> 
> And it is doubly wrong if help backend is configured to be anything but
> manpages, no?
> 
> As I said, you should be able to come up with a patch that detects and
> special cases the no frills case (replacement to single token) to get what
> you want.

But "help" is still too much to type for the OP ;) How about this in your config:

[alias]
	h = help
	hh = "!sh -c 'a=$(git config --get alias.$1); : ${a:=$1}; git help
${a%% *}' -"

Ugly as hell, I know, and works only for aliases whose first word is the name of a git command, as well as for non-aliases. Catching "!command" type aliases is left as an exercise to the reader.

Michael
Previous: Junio C HamanoNext: Gelonida N
Message 7 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.