Git 直接提交子目录中的更改

Git 直接提交子目录中的更改,git,Git,当我处理git repo的子目录时,我应该将dir更改为parent以发出如下命令 $ cd ..; git add .; git commit -m "2018-11-02 17:58:09" ; cd - [master 0984351] 2018-11-02 17:58:09 12 files changed, 558 insertions(+), 13 deletions(-) 更改为父目录,提交更改并更改回 如何直接在子目录下提交?Notgit commit要求您位于repo的顶部

当我处理git repo的子目录时,我应该将dir更改为parent以发出如下命令

$ cd ..; git add .; git commit -m "2018-11-02 17:58:09" ; cd -
[master 0984351] 2018-11-02 17:58:09
 12 files changed, 558 insertions(+), 13 deletions(-)
更改为父目录,提交更改并更改回


如何直接在子目录下提交?

Not
git commit
要求您位于repo的顶部,但您的
git add.
。因此,这应该是可行的:

git add ..; git commit -m "whatever"

Not
git commit
要求您位于repo的顶部,但您的
git add.
。因此,这应该是可行的:

git add ..; git commit -m "whatever"

您可以从子目录提交。使用git add时的路径是相对于当前目录的


因此,如果您想添加当前目录和父目录中的所有内容,请使用
git add..
而不是
git add。

您可以从子目录提交。使用git add时的路径是相对于当前目录的

因此,如果您想
添加当前目录和父目录中的所有内容,请使用
git add..
而不是
git add.