.gitignore is ignored - content in ignored directories is still included in commits

Let’s say you have already added/committed some files (.settings and Reports) to your git repository and you then add them to your .gitignore; these files will still be present in your repository index.

.gitignore is not effective to those files which were already added to the index. If you want to ignore them, you need to remove those files out of the index.

In order to get rid of .settings and Reports, you need to do the following:

$ git rm -r --cached .settings
$ git rm -r --cached Reports

See http://www.codeblocq.com/2016/01/Untrack-files-already-added-to-git-repository-based-on-gitignore/

1 Like