Move work to another branch Mercurial

110 Views Asked by At

I am currently using Mercurial for sub-version control in my project. Now I am suppose to work on a new branch 2.7 but I confuse to work with branch 2.6, I have developed the new feature which the feature on 2.7 but I build on 2.6. And now I want to move this feature to branch 2.7 properly but I don't know how can I move it properly. Is there any way?

2

There are 2 best solutions below

0
On BEST ANSWER

I would recommend using hg graft, which copies changes from one branch to another and unlike hg rebase is not destructive (relevant if you're doing this for the first time and may be making mistakes or if you need the feature to be present on both branches).

To copy changes to a branch dest-branch, do the following. First update to the branch you want to copy the changes to:

hg update dest-branch

Then, use graft to copy the revisions you want from the original branch, e.g.:

hg graft -r start..end

where start is the first revision you want to graft from the source branch and end is the last revision.

You may encounter conflicts if they can't be merged cleanly, which you have to resolve them (as you'd do in a merge), then use hg graft --continue to graft the remaining revisions.

1
On

The magic word is RTFM - hg help rebase