I'm using bash version 4.1.2(1)-release (x86_64-redhat-linux-gnu) on cygwin with git 1.7.1. I wanted to make an alias for a command that needed to use the input argument twice. Following these instructions, I wrote
[alias]
branch-excise = !sh -c 'git branch -D $1; git push origin --delete $1' --
and I get this error:
$> git branch-excise my-branch
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
I've tried both a -
and a --
at the end, but I get the same errors. How can I fix this?
Best Answer
man git-config
says:So:
is an equivalent to:
Running the above script prints:
One solution is to put a whole command in
"
:However, it still doesn't work because
$1
is empty:In order to make it work you need to create a dummy function in
.gitconfig
and call it like this:Usage: