What to do when .gitignore is not ignoring files

September 26, 2017
Tags: » git

Have you ever added new files/paths into your .gitignore and couldn’t figure out why git is still tracking the supposed-to-be-ignored files/paths when you push your code? Well, I have, and here’s why and what to do.

Why:

What to do to fix:

The command “git rm -r --cached .” un-stages and removes all files from the index, and makes git stop tracking the files/paths you just added in the .gitignore file (see documentation here ).

Note: You can also replace the above mentioned line with “git rm -r --cached <filename/path>” if you only want to do this to one file.

♥ Hi there, do you know you can also leave a comment as a guest?
When you click the Name text box, more content will show up. Check I'd rather post as a guest at the bottom of the text boxes, then you're good to go!