another git fast-forward merge revert question

294 Views Asked by At

I was on autopilot last night and unwittingly merged a large feature feature/bigfeature branch into our develop branch and pushed it to the remote origin/develop. I wanted develop to be completely intact and unchanged.

This feature branch was in development for some weeks and part of our workflow was continuously merging origin/develop into it. This makes undoing the merge/push difficult (impossible?)

iceddante$ git checkout develop
iceddante$ git merge origin/feature/bigfeature
Updating 94c8d1f0..298b93fe
Fast-forward
<< lots of files >>

iceddante$ git push 
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/Kinesso/api-reach-optimization.git
   94c8d1f0..298b93fe  develop -> develop

each branch has several commits over time and it is not clear looking at the history how to untangle this. I tried doing a merge commit revert:

git revert 94c8d1f0 -m 1 But this is only reverting the narrow range of commits after the last merge of origin/develop into the feature branch. I identified the merge in the reflog:

19f1ac1b (origin/feature/MPL-5178, feature/MPL-5178) HEAD@{16}: checkout: moving from develop to feature/bigfeature
298b93fe HEAD@{17}: merge origin/feature/bigfeature: Fast-forward 
94c8d1f0 HEAD@{18}: pull: Fast-forward
19553db9 HEAD@{19}: checkout: moving from feature/bigfeature to develop

so I know I could do a git reset --keep develop@{N} but again, it looks like I am losing lots of other merges into origin/develop that are not related to bigfeature. I guess the strategy would be to go all the way back in time and start doing cherry-picks. But is there another way?

0

There are 0 best solutions below