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:
Asked
Active
Viewed 1,028 times
1 Answers
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