In GitHub, I merged a pull request directly using the web interface. After pulling the merged pull request to my local, I noticed a critical bug in the code. So, I went back to github's website and reverted the pull request. This action generated a new pull request, which I inmediately merged back into master.
--C1-----C3-------C1' : master
\ / \ /
-C2- \ / : bug-branch
-C4- : revert-pull-request-1
Where C1 was the state before merging, C3 the merging of the branch containing the bug (C2), and C1' the merging of my revert. Thus, C1' has the same code as C1. C4 was automatically generated by GitHub.
We want all of the commits in our master branch history to be functional copies of our project, so I decided to change history to get C3 out of the master branch. (My team members agreed on that).
So, I moved the HEAD back twice, and the force pushed it.
----C1 : master
|\
| -C2 : bug-branch
| \
|-----C3--C1' : revert-pull-request-1
Now I would like to completely get rid of C1' and C3. But I'm afraid that moving the HEAD again will just mess it up more.
How can I get rid of C3 and C1'? What happened to C4?
----C1 : master
\
C2 : bug-branch
Isn't revert-pull-request-1
just another branch at this point? Deleting that branch should remove the C3
and C1'
commits, leaving you with the history you want.