.gitignore will not allow untracked files from being added (without an add -f) to files tracked by git. However, git will continue to track any files that are already being tracked.

To quit tracking a file you have to remove it from the index. This can be accomplished with this command.

git rm --cached <file>

If you need to remove an entire folder, you have to remove all files in it recursively.

git rm -r --cached <folder>

The removal of the file from the head revision will happen on the next commit.

WARNING: While this won't remove the actual file from your local, it will remove the files from other developer's machines on the next git pull.

0