1

Yeah, sorry I'm a bit noob at git, but I merged my branch(branchA) to a different branch(branchB) and pushed it to remote. I'm supposed to merge it with branch C. Now I want to revert it and just undo all the changes made by branchA to branchB. Is there a way to do that? D:

beef
  • 79
  • 7
  • Possible duplicate of [How to revert a merge commit that's already pushed to remote branch?](http://stackoverflow.com/questions/7099833/how-to-revert-a-merge-commit-thats-already-pushed-to-remote-branch) – Dunno Dec 14 '16 at 09:47

1 Answers1

1

You can select the commit-hash, you want to go back. Then by hard reset remove all the changes. Then do force push, it would replace remote/branchB with your local/branchB.

$ git checkout branchB
$ git log                           # copy the commit-hash you want to back

# go back to a specific commit of branchB
$ git reset --hard <commit-hash>
$ git push -f origin HEAD           # force push, replace remote/branchB by local/branchB
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73