Git remove ignored files

Remove files which are ignored in .gitignore

Posted by on October 12, 2015 Git remove ignored files

Nobody is perfect and sometimes you need to add some folders or files to .gitignore, but they are already pushed to repo. These lines will remove all files from cache and will only add valid files.

git rm -r --cached . 
git add .
git commit -m "Removed all ignored folders and files"
git push origin master