Giving the Cold Shoulder With Git

Some files become unnecessary to track using version control, but still belong in the repository. Compiled assets, for example may require a placeholder for a functional deploy, but don’t need to be checked in every time a change is made.

Adding the file to your gitignore is not enough to stop tracking file changes. You must also clear the file from your git cache:

gitignore, this time with spite
1
2
3
$ git rm --cached [filename]
$ git add .
$ git commit -m "I really mean to ignore this file."

To untrack everything that has been added to the .gitignore:

For realz
1
2
$ git rm -r --cached .
$ git commit -a -m "I mean it!"

Resources

Here’s where I found this gem, and here are the docs where I verified it.