1

So I've got a feature branch that I wanted to merge into my dev branch, but without thinking during my pull request I've synced the branches which has created a merge commit from dev->feature branch before I merged feature->dev. But dev has a lot of stuff I don't want in my feature branch and I need to revert the merge. I've tried:

git checkout feature
git revert #mergecommit

but its giving me

error: commit #mergecommit is a merge but no -m option was given.
fatal: revert failed

I'm stuck at this point and really don't want to mess the branches up trying to revert this badly. Any help would be appreciated.

SkinnyBetas
  • 461
  • 1
  • 5
  • 27
  • https://stackoverflow.com/search?q=%5Bgit%5D+error%3A+commit+is+a+merge+but+no+%22-m%22+option+was+given – phd Jan 28 '21 at 09:15

1 Answers1

3

Try git reset HEAD~1 && git push -f That should rewrite the history and "undo" the merge. Just make sure everyone who is working on it pulls the updated HEAD or it will cause problems.