2013-08-30 133 views
1

.gitignore文件如下:不能添加文件夾gitignore文件

$ cat .gitignore 
Index/ 
Index/LOG 

我添加.gitignore文件回購,承諾,甚至推動。但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: Index/LOG 
# 

因此,如何從永遠git倉庫排除整個Index文件夾?

+0

如果添加了Index/LOG,則應該將其刪除。 –

回答

6

Git不會忽略跟蹤的文件。您需要將該文件從存儲庫中刪除,然後纔會被忽略:

$ git rm -r Index 
$ git commit -m "Deleting 'Index' folder." 

這將刪除文件。如果你只是想從索引中使用--cached其刪除:

$ git rm -r --cached Index 

這將保留所有文件的文件系統,只有從混帳刪除它們。

相關問題