software engineering

How to gitignore an existing file

By Adam K Dean on

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:


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: