git - 如何更新git中的目录

标签 git git-commit

我有一个 bitbucket 存储库,具有以下结构:

 Directory-A->
   directory a
   directory b
   file a
   file b
   file c

现在我想将文件“b”和文件“c”移动到“目录a”

当我在本地机器上执行并通过 git add 提交时。 我在目录 a 中得到文件 b 和文件 c,但它们仍然存在于目录之外。

最佳答案

When I do it on local machine and commit this by git add. I get file b and file c in directory a but they still exists outside it.

那是因为你在 directory a 中执行了 git add . 而不是 Directory- 中的 git add -A . A.

首先,当您执行 git add -A (这是一个 git add -u + git add .) 从根文件夹:

Directory-A->  <====== there: git add -A .
   directory a
     file b
     file c
   directory b
   file a

Directory-A 中的 'git add -A .' 将检测 Directory-A 中那些文件的删除及其添加在目录a中。

在“Difference between “git add -A” and “git add .”中查看更多信息:

关于git - 如何更新git中的目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30801637/

相关文章:

git - 为什么 git remote -v 不显示与我的 .git/config 相同的 url?

Git:如何从推送中排除一个分支?

linux - 进行多次提交和一次推送与每次提交和推送之间有什么区别

git - sublime text 选项 "-n -w"(对于 git)总是打开我以前的标签

git - 如何克隆特定版本的 git 存储库?

没有经验的成员的 Git 工作流程

git - 如何更改过去的提交以包含丢失的文件?

git - 我可以为 git 使用脚本化提交模板吗?

git - 我如何在过去进行 Git 提交?

git - 如何强制 NPM 与 master 从 repo 获取包的最后一次提交?