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

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

    If you just want the two branches 'email' and 'staging' to be the same, you can tag the 'email' branch, then reset the 'email' branch to the 'staging' one:

    $ git checkout email
    $ git tag old-email-branch
    $ git reset --hard staging
    

    You can also rebase the 'staging' branch on the 'email' branch. But the result will contains the modification of the two branches.

提交回复
热议问题