git不会'添加'子目录

时间:2012-06-20 14:15:21

标签: git

OSX上的git看到一个修改后的子目录,但不会“添加”它;我怎样才能解决这个问题?谢谢! (我不相信该子目录中有任何打开的文件)

~/gitrepo/python: git status
# On branch br1
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   v0/mage-Upload (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")
~/gitrepo/python: git add v0
~/gitrepo/python: git add v0/mage-Upload    <-- I guess that was unnecessary
~/gitrepo/python: git diff
diff --git a/v0/mage-Upload b/v0/mage-Upload
--- a/v0/mage-Upload
+++ b/v0/mage-Upload
@@ -1 +1 @@
-Subproject commit 7c377092f1f5cbbeecc03ebb533259c23606506e
+Subproject commit 7c377092f1f5cbbeecc03ebb533259c23606506e-dirty
~/gitrepo/python: git commit -a
# On branch br1
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   v0/mage-Upload (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")

3 个答案:

答案 0 :(得分:4)

尝试将其从缓存中删除,然后重新添加

git rm --cached v0
git add v0

答案 1 :(得分:2)

你显然在“v0 / mage-Upload”中有一个子模块 - 你需要在“超级模块”的变化之前处理子模块中的变化。做类似的事情:

cd vo/mage-Upload
git status
git commit    # Careful if the submodule is not on a branch
              #   see 'git submodule' documentation
git push ...  # Specific to your submodule

此时您可以返回“超级模块”并将更改提交给子模块引用。

答案 2 :(得分:0)

mage-Upload是一个Git子模块。您应该执行以下操作:

cd vo/mage-Upload
git commit -a (or whatever you want to commit)
cd ../..
git commit -a

这将提交子模块中的任何更改,然后将新的子模块版本提交到主存储库。