A month back I submitted a massive Pull Request (20 commits, 30 files) with some code that I had only loosely tested and it wasn't ready for production (test cases weren't finalized and sandbox testing had only been on my localhost.) Long story short, it got merged and broke a lot of things.
It was quickly reverted with git revert -m 1 the errors were logged and I was to work on it when I got a chance again. I switched to that branch, fixed the bugs and made a fresh PR with a few more commits only to find that the first 20 commits weren't there. FUCK! Somehow I needed to revert the revert!
For those visual learners out there, here is an attempt at my commit tree. The messed up commit is the merge that happened at 'C' and the reverted commit that undid my doing is 'K'
H--A--C--K / M--E
A few rainbows and butterflies later I commit some changes at 'B', 'R', 'O' and want to merge back at 'T' but the Pull Request does not contain commits 'M' and 'E'
H--A--C--K----A--T / / M--E----B--R--O
A little googling led me to a nice write-up and explanation on reverting a git revert by the Greek God of Geek himself. For the shortened version
# fix your bugs in your feature branch $ git commit -m 'fixed bugs in feat_poorly_tested_branch' # create new branch tracking develop $ git checkout -b fix_revert_the_revert -t develop # revert the reversion commit grabbed via your git log # to find commit try: 'git log | grep revert -A 5 -B 5' $ git revert 1a2b3c4d5e6f7g8h9i # checkout the original feature branch $ git checkout feat_poorly_tested_branch # merge in the reverted develop $ git merge feat_revert_the_revert # handle merge conflicts and commit and PR # profit