I have just finished fixing an extremely long merge conflict and then realised I merged to the wrong branch! I merged to dev-majorversion
when I meant to merge to dev-majorversion.minorversion
.
Is there any way I can undo the commits that exist on majorversion
but do not exist on minorversion
for branch to undo these commits, or will I need to merge again?
Revert commits unique to a branch
77 views Asked by Max Smashdidypwned Lay At
1
You could cherry-pick your merge resolution:
The git merge --ours records the merge between
<yourBranchToMerge>
anddev-majorversion.minorversion
, but keeps the content ofdev-majorversion.minorversion
intact (including its cherry-picked commit).You would still have to validate that the commit cherry-picked is compatible with the content of
dev-majorversion.minorversion
(since it represents conflict resolution initially done ondev-majorversion
)If so, you can go back to
dev-majorversion
and reset HEAD to the previous commit to cancel the merge done here (assuming the merge was the last operation done ondev-majorversion
, and that is wasn't pushed yet)