2011-10-24 19 views
2

我想添加一個目錄及其中的所有文件到git repo,做完之後 git add "AppDir", 然後運行git status,它仍然顯示「修改內容,未跟蹤內容」,如下圖,是否正常行爲?不能使用git遞歸添加目錄?

運行git commit -a也沒有幫助。下面

git status細節:

bogon:AppDir springrider$ git status 
# On branch master 
# 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: AppDir (modified content, untracked content) 
# 
no changes added to commit (use "git add" and/or "git commit -a") 
+0

'git commit -a'不會添加新文件。但'git add dir'應該可以工作。 – svick

+1

@svick:在這種情況下,OP已經做到了。狀態中的'(修改內容,未跟蹤內容)'消息是獨特的,並且僅針對子模塊/ gitlinks顯示。 –

+0

@MarkLongair啊,我不認識的郵件,所以我只是認爲這是不同版本的Git。這解釋了它。 – svick

回答

3

這裏的問題是,AppDir是一個Git倉庫本身 - 你已經上演了所謂的「gitlink」到該存儲庫。 git status的輸出現在告訴你AppDir存儲庫有未跟蹤的文件和修改的內容。

如果你真的打算這樣做,它可能會更好該庫添加爲submodule,而不是隻是一個普通的gitlink。

+0

非常感謝!我完全誤解了這個信息。 – springrider