Adam K Dean

How to gitignore an existing file

Published on 9 January 2014 at 11:12 by Adam

You have a file which you now want to ignore, such as a compiled css file, but git is already tracking it.

First, add the path to your .gitignore file:

src/path/to/file/style.css

Then, in git bash, we want to clear the cache, so run these commands:

git rm -r --cached .
git add .
git commit -m ".gitignore is now working"

Now push your changes and be free of these bothersome files!

More info: http://stackoverflow.com/questions/11451535/gitignore-not-working



This post was first published on 9 January 2014 at 11:12. It was filed under archive with tags git.