Keep ignored files out of git status
As I found in this post, .gitignore
only works for untracked files. If you added files to repository, you can:
git update-index --assume-unchanged <file>
or remove them from repository by
git rm --cached <file>
Edit
This article explains that too
I've had this issue come up as well, it's probably because you added your ignored directory/files to .gitignore after they were marked as "to be tracked" by GIT in an initial commit flow.
So you need to clear the git tracking cache like so:
git rm --cached -r [folder/file name]
A more detailed explanation can be read here: http://www.frontendjunkie.com/2014/12/stop-git-from-tracking-changes-to.html
The above command also removed the remnants of the folder/files from your remote GIT origin. So your GIT repos become clean.
Problem can be that this file is still in the git cache. To solve this problem needs to reset git cache.
For single file
git rm --cached <file>
For whole project
Reset git cache. It is good command if you committed project when .gitignore file was not added.
git rm -r --cached .
Commit changes
git add .
git commit -m ".gitignore was fixed."
This surely works,
git rm --cached -r [folder/file name]