Home > database >  undoing shared merge feature branch from remote
undoing shared merge feature branch from remote

Time:11-21

  • I have a develop branch and a features branch called init-work .
  • I push my changes in the gitlab
  • Before i do a pull request I accidentally merge my init-work into develop.
  • So now I need to unmerge my init-work from develop.

enter image description here How do I go about this?

Here's what I'm thinking: i think to do git push -f feature/init-work no ?

CodePudding user response:

Assuming this is a multiuser project, it's better to revert it, then rebase the feature branch so that git thinks that it is not merged at all.

git checkout develop
git revert HEAD # given that it is the last commit in the branch
git push origin develop # push it into the remote
git checkout feature/init-work
git commit --amend --no-edit # create a brand new revision separate from the one that was merged/reverted in develop
# now it can be rebased on top of develop
git rebase develop
  • Related