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

前端 未结 13 1313
广开言路
广开言路 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:26

    I've seen several answers and that's the only procedure that let me fix that without any conflicts.

    If you want all changes from branch_new in branch_old, then:

    git checkout branch_new
    git merge -s ours branch_old
    git checkout branch_old
    git merge branch_new
    

    once applied those four commands you can push the branch_old without any problem

提交回复
热议问题