我正在使用PyCharm編寫Python項目,其中包括我的項目中的.idea
文件夾。爲什麼我不能讓git忽略文件夾?
由於該項目的維護者不希望貢獻者編輯項目的.gitignore
,我添加了一個.gitignore_global
文件~/{myuser}
兩行:
# comment line because git has a bug where sometimes the first line is ignored
.idea/
我跑的命令
git config --global core.excludesfile "C:\\Users\\{myuser}\\.gitignore_global"
運行git status
,仍然出現以下內容:
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/
我試圖同時運行這些命令:
git rm --cached -r .idea/
git update-index --assume-unchanged .idea/
在錯誤的結果:
fatal: pathspec '.idea/' did not match any files
第二個變化無關。
如何讓git忽略此文件夾?
Git版本1.9.5.msysgit.1他表明,它出現在'未追蹤文件:'部分,所以它不回購,因爲它應該是,唯一的問題似乎忽略規則不起作用。 – kan