Update Git to respect a newly added .gitignore

git rm -r --cached .

Adding a .gitignore file to an existing project will prevent untracked files being added to the working tree but the files will still remain at the staging area (Git Index).

But not all is lost and it is possible to remove the files we want to ignore from Git Index.

git rm -r --cached .
git add .

Subscribe to The infinite monkey theorem

Get the latest posts delivered right to your inbox