0

I merged and committed two branches on GitHub using the web editor (and not on my local machine). I want to undo this committed merge, but am not sure what to do since all answers on here refer to merges that were done locally before pushing.

  • cant you update your local base and then undo the last commit? – Hassan Mar 17 '17 at 16:36
  • Yeah. How? (I'm totally new to this) – user7518095 Mar 17 '17 at 16:37
  • Have a read at this, would help. Also you can clone your git repo to a new folder to play around with these changes and keep one copy backed up in case you feel unsure. http://stackoverflow.com/questions/7099833/how-to-revert-a-merge-commit-thats-already-pushed-to-remote-branch – Hassan Mar 17 '17 at 16:40

1 Answers1

0

This is a solution that can help you, and this is defenitely not the only one !

Pull on the branch you merged into :

git pull origin <yourbranch>

Reset your last commit :

git reset @^

And force push to your branch :

git push origin +<yourbranch>
(or)
git push origin <yourbranch> -f
Val Berthe
  • 1,899
  • 1
  • 18
  • 33