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

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

    I wanted to merge two branches so that all the contents in old_branch to be updated with the contents from new_branch

    For me this worked like a charm:

    $ git checkout new_branch
    $ git merge -m 'merge message' -s ours origin/old_branch
    $ git checkout old_branch
    $ git merge new_branch
    $ git push origin old_branch
    

提交回复
热议问题