How do I 'overwrite', rather than 'merge', a branch on another branch in Git?

前端 未结 13 1385
广开言路
广开言路 2020-11-27 08:51

I have two branches, email and staging. staging is the latest one and I no longer need the old changes in email branch, y

13条回答
  •  执笔经年
    2020-11-27 09:40

    The easiest way to do it:

    //the branch you want to overwrite
    git checkout email 
    
    //reset to the new branch
    git reset --hard origin/staging
    
    // push to remote
    git push -f
    

    Now the email branch and the staging are the same.

提交回复
热议问题