Git push to wrong branch

后端 未结 3 1065
悲&欢浪女
悲&欢浪女 2021-01-29 21:32

Working with git, after some \'commit\', and a couple of \'push\', I realized that am using the wrong branch !

Now I have to remove in some way my changes in wrong_branc

3条回答
  •  被撕碎了的回忆
    2021-01-29 22:10

    A bit of shortcut adding to Dhruva's answer

    git checkout wrong_branch
    git revert commitsha1
    
    git checkout right_branch
    git push right_branch
    
    git checkout wrong_branch
    git reset commitsha2 #commit just before commitsha1
    git push wrong_branch -f
    

提交回复
热议问题