You're talking about a command that includes a space, but here the command is git
and there's no space in there.
To call a git commit command, you'd need to write it
git\ commit ...
'git commit' ...
"git commit" ...
Generally commands don't have space in their names for that reason that it is cumbersome to call them in a shell, so I don't think you'll find such a command on your system.
csh, tcsh or zsh will allow you to alias any of those above, but not bash or ksh (though pdksh will allow you but you won't let you use them). In zsh:
alias "'git commit'=git commit -v"
'git commit' ...
Will make the git command
command (when called as 'git command'
(with the single quotes) only) an alias for the git
command with the commit
and -v
arguments. Not what you were looking for I'd guess though.
Because alias
can only alias commands, all you can alias here is the git
command, and you'd need to alias it to something that inserts a "-v" after "commit" in its list of arguments. Best would be to go with @jw013's solution but if for some reason you can't or wouldn't, instead of using an alias, you could use a function to do the job:
git() {
if [ "$1" = commit ]; then
shift
set -- commit -v "$@"
fi
command git "$@"
}
git config
notgit-config
– Michael Durrant Sep 25 '12 at 13:46git
commands with aliases, with just a little bit of shell script. (I'm not posting this comment as a criticism, BTW. That answer was posted nearly a year after yours! I'm just posting it in the hope that people might find it helpful.) – Apr 07 '18 at 17:59