Recently, I’ve accidentally merged a bad pull request in GitHub.
What I had to do was
git revert that merge commit and then
work on a new branch that starts with reverting that revert
(see Undoing Merges).
If you haven’t been to this kind of situation yet, and you’re using GitHub, then your life will be easier from now on since they’ve released a new nifty feature: the Revert Button.
It will create a new pull request that will revert the bad merge, skipping the need to do this via command line.
This will be helpful if, by some chance, you’ve accidentally merged an unfinished pull request while reviewing a it from a tablet.
For details, see this GitHub help article.