git commit exclamation results in zsh: illegal modifier:

git commit exclamation results in zsh: illegal modifier:

我是 运行 Zsh 的最新可用稳定版本并且 运行 在 git 提交消息中使用 ! 感叹号出现错误,如下传统的提交风格。 https://www.conventionalcommits.org/en/v1.0.0/

→ zsh --version
zsh 5.8 (x86_64-apple-darwin19.3.0)

和 zsh-offending 提交消息:

→ git commit -am "chore(foo)!: bar"    
zsh: illegal modifier:

我在 Bash、Fish 和 Hyper 中尝试了相同的命令,并且都成功了,没有问题。所以这似乎是另一个不稳定的 Zsh 细微差别。有人有 zsh 的修复程序吗?我真的很想能够使用 -am shorthand 而不是必须进入完整的 git commit 交互式编辑器。

zsh! 解释为历史扩展的开始。只需使用单引号而不是双引号。

git commit -am 'chore(foo)!: bar'