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?
I have a config file which was committed earlier by mistake. I added it
Share
If a file is already being tracked (has been committed, and specifically exists in your
HEADcommit), it cannot be ignored via.gitignore. If you want to prevent it showing up in future checkouts, you need togit rm --cached <file>; git commit -m "stop tracking <file>". If also removing the copy in your working directory is acceptable, you can drop the--cachedoption togit rm.