giving the cold shoulder with git

September 08, 2014

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:

$ 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:

$ 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.


Mostly Katie explaining things to herself.

© 2022