# First solution
$ git rm -r --cached . # We remove
$ git add . # We stage
$ git commit -m "Clean up ignored files" # We commit
# Second solution : if you have a lot of files
# It's basicaly the first solution in one line
git rm --cached `git ls-files -i -c --exclude-from=.gitignore`
# If you are on Windows and the line above didn't work, try this one in Powershell
git ls-files -i -c --exclude-from=.gitignore | %{git rm --cached $_}