Git 认为提交消息是未找到的命令

Git thinks a commit message is a command not found

我正在学习 Udacity 课程,在输入以下内容后:

g cmp "adds string.replace() quiz"

我收到了错误消息

git:3: command not found: quiz
git:80: command not found: quiz
git:84: command not found: quiz

现在输入任何 git 命令 returns

git:1: command not found: quiz

撤消提交是否可以解决问题?搜索时找不到这样的东西。我正在使用 Zsh,作为记录。

我的 git 别名来自这个 repo: https://github.com/Prelang/g

g cmp is alias for git commit with message 以来,也许 () 不会在那种情况下进行解释。

尝试(在新的 shell 中)没有 () 的相同命令。

g cmp "adds string.replace quiz"

Nils Werner points out in 一样,单引号 应该 阻止了对 () 的解释,但别名定义可能存在另一个问题。

Zsh interprets some aspects of the contents of double quotes。为确保 zsh 将您的字符串视为原始字符串并且不进行任何解释,您应该使用单引号:

git commit -m 'adds string.replace() quiz'

请注意,您的 git 别名中可能有双引号,这也可能会造成干扰。