Forget about a file that was tracked, but is now in .gitignore?

To stop tracking a file, we must remove
it from the index:

git rm --cached <file>

To remove a folder and all files in
the folder recursively:

git rm -r --cached <folder>

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