Skip to contentSkip to conversation

Advanced aliases with arguments (?)

DISCUSSION Mike Hommey 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

I read on http://git.or.cz/gitwiki/Aliases that

Starting with version 1.5.3, git supports appending the arguments to commands prefixed with "!", too. If you need to perform a reordering, or to use an argument twice, you can use this trick:

[alias]
example = !sh -c "ls $1 $0"

AFAICT, it doesn't work with the 1.5.3.5 I use. Is it false advertising or was there some regression ?

Mike

#1 lore raw
Quoted 9 lines · Mike Hommey

Hi,

I read on http://git.or.cz/gitwiki/Aliases that

Starting with version 1.5.3, git supports appending the arguments to commands prefixed with "!", too. If you need to perform a reordering, or to use an argument twice, you can use this trick:

Quoted 6 lines

[alias]
example = !sh -c "ls $1 $0"

AFAICT, it doesn't work with the 1.5.3.5 I use. Is it false advertising or was there some regression ?

Aaaah it does work, but you need to use single quotes, not double quotes.

Mike