带有多个命令和标志的Git alias无法工作

带有多个命令和标志的Git alias无法工作,git,terminal,sh,Git,Terminal,Sh,今天早上,当我试图使用 git config --global alias.ac '!sh -c "git add . && git commit -m $0"' 但由于错误,在git ac“完成静态页面”之后,它无法工作 fatal: Option -m cannot be combined with -c/-C/-F/--fixup. 到处找了又找,还是让我头疼。为什么我不能将-m选项与sh-c结合使用?我应该如何正确地执行此操作?非常感谢 编辑 如果我使用 而不是最后的

今天早上,当我试图使用

git config --global alias.ac '!sh -c "git add . && git commit -m $0"'
但由于错误,在git ac“完成静态页面”之后,它无法工作

fatal: Option -m cannot be combined with -c/-C/-F/--fixup.
到处找了又找,还是让我头疼。为什么我不能将-m选项与
sh-c
结合使用?我应该如何正确地执行此操作?非常感谢

编辑 如果我使用

而不是最后的
$0
,它会说

sh: git add -A ; git commit --message Finish static pages: No such file or directory
fatal: While expanding alias 'ac': 'sh -i "git add -A ; git commit --message $1"': No such file or directory

我想我正在寻找一种接受字符串而不是单字参数的方法,也许?

尝试使用
$1
而不是
$0

git config --global alias.ac '!sh -c "git add . && git commit -m \"$1\""'
$0
将在提交消息中重复整个命令。意思是,。
您可以尝试为消息添加双引号:
\“$1\”


该类别名还有其他选项:请参见“.”。
比如说

git config --global alias.ac '!f(){ git add . && git commit -m "$1"; };f'

我很确定,因为我每次都会重复相同的问题,现在我尝试使用其他标志,但肯定这些其他标志更错误。它将调用另一条错误消息,请查看我的新编辑:-)谢谢,我认为它无法接受以下字符串“完成静态页面”也是一个问题,也许?这就是我们正在讨论的;)非常感谢。
git config --global alias.ac '!f(){ git add . && git commit -m "$1"; };f'