Reputation: 1487
I have a config file which was committed earlier by mistake. I added it to .gitignore and also did a git update-index --assume-unchanged
, but when I do a git checkout -- .
, it reverts it back to an older, committed version. How can I ignore it completely?
Upvotes: 1
Views: 54
Reputation: 62379
If a file is already being tracked (has been committed, and specifically exists in your HEAD
commit), it cannot be ignored via .gitignore
. If you want to prevent it showing up in future checkouts, you need to git rm --cached <file>; git commit -m "stop tracking <file>"
. If also removing the copy in your working directory is acceptable, you can drop the --cached
option to git rm
.
Upvotes: 5