Currently, I got following alias
[alias]
comment = commit -m
It works fine for
git comment 'Export env'
But wanted to make it work without quotes
[alias]
comment = !"git commit -m ${*}"
This runs into errors
$ git comment Export env
error: pathspec 'env' did not match any file(s) known to git
error: pathspec 'Export' did not match any file(s) known to git
error: pathspec 'env' did not match any file(s) known to git
Why do things in complex ways when the answer for question "How to write an alias that accepts parameters" is quite well-known — use a shell function inside an alias:
Examples (with
echo git commit "$*"):It's not obvious from the
echooutput it is exactly one parameter "foo bar" but it is.