Git undo push
-
You are on branch B, but actually you are supposed to be on branch A. You did a lot of updates, and pushed the change to the origina/branchB. How to fix this?
- git reset --soft HEAD~1 //undo the last commit
- git stash //save current changes
- git push -f origin branchB //reset remote branch
- switch to branchA
- git stash pop // recover current changes
- push