I know that\'s rewriting of history which is bad yada yada.
But how to permanently remove few commits from remote branch?
Simplifying from pctroll's answer, similarly based on this blog post.
# look up the commit id in git log or on github, e.g. 42480f3, then do
git checkout master
git checkout your_branch
git revert 42480f3
# a text editor will open, close it with ctrl+x (editor dependent)
git push origin your_branch
# or replace origin with your remote
This might be too little too late but what helped me is the cool sounding 'nuclear' option. Basically using the command filter-branch
you can remove files or change something over a large number of files throughout your entire git history.
It is best explained here.