如何git提交一个文件/目录 [英] How to git commit a single file/directory

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

问题描述

试用下面的命令:

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

在git版本1.5.2.1中收到错误:

 错误:pathspec'-m'与git已知的任何文件都不匹配。 
错误:pathspec'我的MESSAGE'与git已知的任何文件都不匹配。

是否有单独的文件或目录提交语法?



答案: 提交-m'我的笔记'路径/ to / my / file.ext



...但它不再严格:)

解决方案

您的参数错误顺序。尝试 git commit -m'我的笔记'路径/ 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是当前版本)。


Tried the following command:

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

Receive 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 there a new syntax for singe file or directory commits?

ANSWER: Arguments are expected in this order...

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

...however it's not even strict anymore :)

解决方案

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.

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提交一个文件/目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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