2012-06-20 68 views
1

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") 
+0

它表示'提交或放棄submodules中未跟蹤或修改的內容... ...您正在使用子模塊。 –

回答

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 

此時,您可以返回'超級模塊'並將更改提交給子模塊引用。

4

試圖將其從緩存中刪除,然後重新添加

git rm --cached v0 
git add v0 
+0

沒有幫助那裏(添加-r選項) – user1405141

+0

我可以吹走.git /並只是重新初始化本地回購? – user1405141

+0

我不知道你是如何進行項目設置的,但是以我的經驗來說,使用git刪除東西並嘗試重新開始通常會導致更多的頭痛在別的地方(除非它全部來自澱粉)。 –

0

mage-Upload是一個Git子模塊。你應該做到以下幾點:

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

這將提交輔助模塊進行任何更改,然後提交新的子模塊的版本到主存儲庫。