How to make Git “forget” a file that was tracked now it is in .gitignore?
Asked by Sohail · · 3 answers
First, remove all of the items from the Git Index (not from the working directory or local repo), and afterward refreshes the Git Index, while respecting git ignores.
git rm -r --cached . git add . git commit -am "Remove ignored files"
git rm -r --cached . && git add . && git commit -am "Remove ignored files"