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

Re: git-config: aliases with parameter expansion ($1 and such)

From
Jay Soffian <jaysoffian@gmail.com>
Date
Mar 24, 2008, 01:54 UTC
Message-ID
<76718490803231854u6ee76437h5acf37b0b602f3b1@mail.gmail.com>
In-Reply-To
<20080323194514.GA23492@coredump.intra.peff.net>
On Sun, Mar 23, 2008 at 3:45 PM, Jeff King <peff@peff.net> wrote:
Show 8 quoted lines
>  Hmm, I take it back. Git is doing the right thing, but it is a quirk of
>  the shell that it counts the first argument as the "name of the script"
>  even though the script actually comes from "-c".
>
>   $ sh -c 'echo $0' foo
>   foo
>   $ echo 'echo $0' | sh
>   sh
All my shell aliases therefor look like:
h          = "!sh -c 'git alias \"$1\" || git help \"$1\"' -"
(Notice the trailing '-'.)
j.
Previous: Jeff KingNext: Junio C Hamano
Message 9 of 13 in “git-config: aliases with parameter expansion ($1 and such)”
  1. Dirk SüsserottMar 23, 2008
  2. Jay SoffianMar 23, 2008
  3. Dirk SüsserottMar 23, 2008
  4. Johannes SchindelinMar 23, 2008
  5. Dirk SüsserottMar 23, 2008
  6. Jeff KingMar 23, 2008
  7. Jeff KingMar 23, 2008
  8. Jeff KingMar 23, 2008
  9. Jay SoffianMar 24, 2008
  10. Junio C HamanoMar 24, 2008
  11. Dirk SüsserottMar 24, 2008
  12. Jeff KingMar 24, 2008
  13. Jay SoffianMar 24, 2008

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.