2013-10-11 39 views
3

所以,我已經建立了我的全局.gitignore文件忽略所有具有.iml結尾的文件。但是,由於某種原因,它不會忽略一個特定的iml文件。我有我的忽略文件和Git有選擇地忽略儘管gitignore文件

~/projects/dhub 
calebsutton$cat /home/calebsutton/.gitignore 
*.iml 

~/projects/dhub 
calebsutton$git status 
# On branch DM-481 
# Changes to be committed: 
# (use "git reset HEAD <file>..." to unstage) 
# 
# new file: app/web/src/main/java/com/wellcentive/integration/page/sourcetype/SourceTypeActionPage.java 
# new file: app/web/src/main/java/com/wellcentive/integration/page/sourcetype/SourceTypeListPage.java 
# new file: app/web/src/main/java/com/wellcentive/integration/page/sourcetype/grid/SourceTypeListGrid.java 
# 
# 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: app/web/src/main/java/com/wellcentive/integration/page/sourcetype/grid/SourceTypeListGrid.java 
# modified: app/web/web.iml 
# 

回答

7

運行命令:

git ls-files --others | grep web.iml

尋找在未跟蹤文件列表中特定文件。如果它不在該列表中,那麼您需要解開它。

(信貸jthill此)

git ls-files -ic --exclude-standard 

也做的第一個命令做什麼。

在這一點來看:

git rm --cached app/web/web.iml 

這將刪除您的跟蹤的文件列表中的文件web.iml不從目錄中刪除。

+2

列出錯誤追蹤文件的更直接的方法是'git ls-files -ic --exclude-standard'。 – jthill