git rm -r --cached .
git add .
git commit -m "update gitignore"
# NEVER run "git rm -r --cached .", it will reinitialize your whole project.
# just remove the destination file/folder instead of removing all folder and file.
# for example:
# if you recently adding "/public/js/app.js" in your .gitignore file,
# just run "git rm -r --cached .publicjsapp.js", and then "git commit ..."
# don't be a lazy people.
#
# trust me, i have a bad day after running "git rm -r --cached ." command.
git rm -r --cached .path o<your_file.extension>
git commit -am "Commit Message"