1

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")
4

3 回答 3

4

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

git rm --cached v0
git add v0
于 2012-06-20T14:18:40.077 回答
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

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

于 2012-06-20T23:33:29.050 回答
0

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

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

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

于 2012-06-21T00:12:56.437 回答