2010-10-02 94 views
0

這可能是缺少咖啡,但我剛剛有一些,所以我會繼續前進,問問。爲什麼git像添加文件一樣添加我的目錄?

下面是我與我的終端進行的字面上的演講,爲了便於閱讀,使用了換行符。

$ ls -la 
total 28 
drwxr-xr-x 5 thomas thomas 4096 2010-10-02 09:32 . 
drwxr-xr-x 153 thomas thomas 12288 2010-10-02 09:30 .. 
drwxr-xr-x 5 thomas thomas 4096 2010-10-02 09:31 content 
drwxr-xr-x 3 thomas thomas 4096 2010-10-02 09:31 template 
drwxr-xr-x 7 thomas thomas 4096 2010-10-02 09:31 typely 

$ git --version 
git version 1.7.0.4 

$ git init . 
Initialized empty Git repository in /home/thomas/typely/.git/ 

$ git add -A 

$ git st 
# On branch master 
# 
# Initial commit 
# 
# Changes to be committed: 
# (use "git rm --cached <file>..." to unstage) 
# 
# new file: content 
# new file: template 
# new file: typely 
# 
# Changed but not updated: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
# modified: content 
# modified: typely 
# 

但這些都是目錄!而且,自從我添加它們以來,它們還沒有被修改過。

認爲目錄可能有問題,我試圖cp -r到一個新的目錄,但同樣的事情發生。如果我直接將文件git add,git不會抱怨,但它們也不會在git st中出現。

我在想我嗎?

回答

2

它們被視爲submodules,Git將它作爲一種特殊的文本文件存儲在超級庫中。在修改git diff時,會將它們顯示爲包含文本Subproject commit加上提交SHA1 ID的文件。

2

找到它。這些目錄都包含單獨的git存儲庫!

$ find -name .git 
./content/.git 
./template/.git 
./typely/.git 

我在這裏留下問題,以防其他人遇到這個問題。

相關問題