I know that if I want to ignore folder that I don't want to push to Github. I could use
It seems like the
--cached option of git rm is what you want.
git rm --cached fileToDelete git commit master git push origin master Now add the file to .gitignore
Not tested though.