Why? One scenario: you write on a paper using LaTeX, compile the
git add .,
git commit -m "created pdf",
git push, and
then you recognize that all the files you are not interested in,
i.e. basically all besides the
.tex file are tracked…
First make sure to commit all changes in the repository to not accidentally lose any work.
- put them in
recursively clean the index
git rm -r --cached .
git add .
commit your changes
git commit -am "Remove ignored files"
Of course, I had help in finding this. Thanks Matt Frear