Rafid Rafid - 10 days ago 6
Git Question

GIT: How to 'overwrite', rather than 'merge', a branch on another branch

I have two branches,

email
and
staging
.
staging
is the latest one and I no more need the old changes in
email
branch, yet I don't want to delete them. So I just want to dump all the contents of
staging
into
email
so that they both point to the same commit. Is that possible?

Answer

you can use the 'ours' merge strategy:

$ git checkout staging
$ git merge -s ours email # merge branches, but use our branch head
Comments