Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force merge branches

Tags:

mercurial

Is there any way to force merge branch A in branch B where all possible conflicts will be resolved in favor of branch B?

In any words how to push last branch B revision in branch A without vanity around conflicts?

like image 224
Alex Povar Avatar asked Mar 07 '13 10:03

Alex Povar


People also ask

How do I force merge a branch into master?

First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch.

How do I combine multiple branches into one?

To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.


1 Answers

You can decide to take all of one branch over another by using hg merge --tool internal:other or hg merge --tool internal:local

I'm not sure which way you want to merge but if you want to merge A into B taking all changes from B then you would do the following:

> hg update B
> hg merge A --tool internal:local
> hg commit -m "Merge"

The internal:local merge tool will take the changes in the current revision (which is B because of the hg update B) over the changes in the other revision, internal:other would take all changes from A.

For more info use the following commands: hg help merge and hg help merge-tools

like image 101
Steve Kaye Avatar answered Sep 28 '22 15:09

Steve Kaye