SztupY
SztupY

Reputation: 10526

Easiest way to perform incremental merge in mercurial

I have a project, that have branched sometime. Both branches have had a lot of commits since the split, and I want to merge them into one. Simply merging the two heads is not enough because it has too many conflicts, and the merged branch is also unstable, and non-functional.

Therefore I want to incrementally merge the two branches. By incremental I mean I take the tip of one of the branches and apply the changes from the other one one at a time. Testing each merge, and continuing if everything goes well.

What is the easiest way to do this using mercurial?

Upvotes: 8

Views: 267

Answers (2)

jkerian
jkerian

Reputation: 17016

You've pretty much outlined a strategy yourself. Assume you have two heads, named headA and headB. hg up -r headB to one of the two heads, then use hg merge -r X repeatedly, where X is a revision along the other line of development.

You can use hg log -r 'ancestor(headA,headB)::headA' to get a list of good candidates for these merges (depending on overall topology).

Upvotes: 6

nmichaels
nmichaels

Reputation: 50943

You can use hg transplant to pull specific changesets into a branch.

Upvotes: 0

Related Questions