如何'git commit'单个文件/目录 [英] How to 'git commit' a single file/directory

查看:118
本文介绍了如何'git commit'单个文件/目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下命令:

git commit path/to/my/file.ext -m 'my notes'

并在Git版本1.5.2.1中收到错误:

And received an error in Git version 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.

单个文件或目录的语法不正确吗?

Is that incorrect syntax for a single file or directory commits?

答案:

参数 按此顺序...

git commit -m'我的笔记'path/to/my/file.ext

而且不再严格:)

推荐答案

您的参数顺序错误.尝试使用 git commit -m'我的笔记'path/to/my/file.ext ,或者如果您想更明确地使用 git commit -m'我的笔记'-path/到/my/file.ext.

Your arguments are in the wrong order. Try git commit -m 'my notes' path/to/my/file.ext, or if you want to be more explicit, git commit -m 'my notes' -- path/to/my/file.ext.

顺便说一句,Git v1.5.2.1已有4.5年的历史了.您可能需要更新到较新的版本(当前版本为1.7.8.3).

Incidentally, Git v1.5.2.1 is 4.5 years old. You may want to update to a newer version (1.7.8.3 is the current release).

这篇关于如何'git commit'单个文件/目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆