Remove files that are listed in the .gitignore but still on the repository.

git rm --cached file1 file2 dir/file3
Or, if you have a lot of files:
git rm --cached 'git ls-files -i --exclude-from=.gitignore'

Comments