How to merge two branches in Mercurial when there is nothing to merge

前端 未结 2 1115
小鲜肉
小鲜肉 2020-12-23 17:08

I\'m new to mercurial and I\'m trying to do something really simple but can\'t figure out how to. I created a branch to do some experimentation without disturbing the main b

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-23 17:35

    Once you've created a branch, you can't exactly achieve a single default branch (with some exceptions, see below). However, you should be able to merge experiment into default and achieve the same thing.

    If you start with this:

    enter image description here

    and perform this:

    hg update trunk
    hg merge experiment
    

    you should end up with this:

    enter image description here

    Other options:

    Using rebase or a patch queue you could actually relocate the changesets on the experiment branch back on to default. This would basically remove the experiment named branch and create a few more default changesets. You cannot do this, however, if you've already shared the changesets form the first image, above, with another user.

提交回复
热议问题