我尝试了以下命令:
git commit path/to/my/file.ext -m 'my notes'
并在Git版本1.5.2.1中收到错误:
error: pathspec '-m' did not match any file(s) known to git.
error: pathspec 'MY MESSAGE' did not match any file(s) known to git.
单个文件或目录提交语法是否不正确?
答案:
参数应按此顺序排列...
git commit -m 'my notes' path/to/my/file.ext
它不再是严格的:)
发布于 2012-01-10 04:58:44
你的论点顺序不对。尝试使用git commit -m 'my notes' path/to/my/file.ext
,或者如果您想更明确,可以使用git commit -m 'my notes' -- path/to/my/file.ext
。
顺便说一句,Git v1.5.2.1已经4.5岁了。您可能希望更新到较新的版本(当前版本为1.7.8.3)。
发布于 2012-01-10 04:59:26
尝试:
git commit -m 'my notes' path/to/my/file.ext
发布于 2016-02-16 08:41:31
如果您在包含该文件的文件夹中
git commit -m 'my notes' ./name_of_file.ext
https://stackoverflow.com/questions/8795097
复制相似问题