問題:
.gitignore只能忽略那些原來沒有被track(之前沒有add過)的文件,
如果某些文件已經(jīng)被納入了版本管理中,則修改.gitignore是無效的。
解決方案:
先把本地緩存刪除(改變成未track狀態(tài)),然后再提交:
git rm -r --cached target
git rm -r --cached .idea
報錯加 -f
the following file has staged content different from both the file and the HEAD:.idea/.gitignore
(use -f to force removal)
git rm -r -f --cached .idea