2014-03-03 36 views
0

我的.gitignore文件爲什麼沒有git忽略我的子目錄?

ext/templates_c 

我的git的狀態調用

D:\Development\online\site\newsite>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) 
# 
#  modified: ext/pages/config.php 
#  modified: ext/templates_c/60a4cccd667e8b1e3a702b2a2c9108f056837adc.file.pages.html.php 
#  modified: ext/templates_c/fd38ffaa13c6f4c29772bec22cad5aebb1d4d7f6.file.form.html.php 
# 
no changes added to commit (use "git add" and/or "git commit -a") 

難道我做了一件很愚蠢?

爲什麼心不是混帳忽略EXT/templates_c

回答

0

當我寫這個文件,我發現

ext/templates_c 

不工作,但

ext\templates_c 

一樣。

所以你需要使用windows斜線。

1

git status將「ignored」子目錄中的文件顯示爲「modified」這一事實意味着這些文件已被git跟蹤。因此,只需將目錄添加到.gitignore不足以使這些文件被忽略(儘管該目錄中的新文件將被正確忽略)。您需要爲當前跟蹤的目錄中的每個文件執行git rm --cached <file>