Mercurial - merge two branches into a 3rd new branch

Is it possible to merge 2 branches into a 3rd new branch instead of merging one branch into another existing branch?

+5
source share
1 answer

Just merge the two existing branches and consider merging as the tip of the 3rd new branch and the previous chapters of the merged branches as the 1st and 2nd branches:

o    changeset:   3:92692c4a6b12
|\   bookmark:    masala
| |  summary:     merge salt and pepper
| |
| o  changeset:   2:a5f955adf03d
| |  bookmark:    pepper
| |  summary:     add some pepper
| |
o |  changeset:   1:2b56f2dc115f
|/   bookmark:    salt
|    summary:     add some salt
|
o  changeset:   0:e992ce7dd508
   summary:     initial

Here, bookmarks are used to indicate different lines in development. Therefore, if you want to work in the new 3rd branch, upgrade to masala, if you want to work in your first branch, upgrade to saltand similarly to update the 2nd branch to pepperbefore continuing with work and committing.

( ), hg branch masala, 2 1.

, , 3 .

, , 2- , pepper:

$ hg up pepper
... hack ...
$ hg ci -m "need more pepper"

salt:

$ hg up salt
... hack ...
$ hg ci -m "less salt please"

3 :

o  changeset:   5:d1f8eb72119a
|  bookmark:    salt
|  summary:     less salt please
|
| o  changeset:   4:acc9b01f584f
| |  bookmark:    pepper
| |  summary:     need more pepper
| |
+---o  changeset:   3:92692c4a6b12
| |/   bookmark:    masala
| |    summary:     merge salt and pepper
| |
| o  changeset:   2:a5f955adf03d
| |  summary:     add some pepper
| |
o |  changeset:   1:2b56f2dc115f
|/   summary:     add some salt
|
o  changeset:   0:e992ce7dd508
   summary:     initial

. . , .

+7

All Articles