|
|
|
|
|
by varl
2048 days ago
|
|
I'm not entirely sure, but `:` means "true" in bash, and if I omit it, something like this happens: $ git config alias.foo '! echo "$1";'
$ git foo bar
bar
echo "$1";: bar: command not found
Whereas if I end with `; :` then it works as expected: $ git config alias.foo '! echo "$1"; :'
$ git foo bar
bar
It seems to execute the last argument (`bar`) as a command without the `:` at the end, and I don't have a `bar` command on my PATH so it angrily fails with exit code 127. If it instead executes `:` however, that will make it happily exit with 0.It seems to be a Git alias quirk, but I may be incorrect here. |
|
I've done aliases like `!bash -c 'foo $1' sh` before, but on seeing yours, I see that it was unnecessary to re-wrap with bash.
[1] https://github.com/git/git/blob/e31aba42fb12bdeb0f850829e008...