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

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

From
DSDirk Süsserott <newsletter@dirk.my1.cc>
Date
Mar 23, 2008, 14:04 UTC
Message-ID
<47E66382.5030800@dirk.my1.cc>
In-Reply-To
<76718490803230645k13471472sc99932563b0239da@mail.gmail.com>
Jay Soffian schrieb:
Show 30 quoted lines
> On Sun, Mar 23, 2008 at 9:28 AM, Dirk Süsserott <newsletter@dirk.my1.cc> wrote:
>   
>> Hi, I've a question concerning git config and the alias things.
>>  I'd like to create an alias 'atag' that creates an annotated
>>  tag with the message being the same as the tag. Usually I create
>>  annotated tags like this:
>>
>>  $ git tag -a -m "mytag" mytag
>>
>>  (BTW: It's not documented, but I have the impression that
>>  the '-a' switch is implicitely added when the '-m' switch
>>  is present. Is that true?)
>>
>>  I'd like to have an alias like this:
>>
>>  [alias]
>>     atag = tag -a -m "$1"
>>
>>  So that I can simply call
>>
>>  $ git atag mytag
>>
>>  Is it possible to pass parameters to the alias definition?
>>  With the definition above I got a tag with message "$1".
>>     
>
> atag = !git tag -a -m "$1"
>
> j.
>   
Thanks for the quick reply. Did you try that out? I did
$ git atag foo

with your definition and got a tag with message "$1" and the tag's name was "'foo'" (surrounded by single quotes).

If you tried it and it worked (with linux), then it might be a problem with my environment: I'm using Git with windows and the bash (Git-1.5.4-preview20080202.exe). Usually that works very good, but sometimes it doesn't. Probably this is one of the few "it doesn't" things.

Dirk
Previous: Jay SoffianNext: Johannes Schindelin
Message 3 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.