Make another branch default?

后端 未结 4 523
萌比男神i
萌比男神i 2020-12-25 12:20

I have a Mercurial repo at Bitbucket and on my local machine, both are mirrors, up to date. I created a feature branch, reflected in both repos. I did all my work in the fea

4条回答
  •  轮回少年
    2020-12-25 13:15

    Since Mercurial 2.4, you can create an bookmark called @ and Mercurial will checkout that revision new clones.

    However, I would still try to stick with using default as the branch where the main development takes place. Doing so will cause the least amount of surprise for developers already used to Mercurial — the wiki describes the standard way to use branches in Mercurial.

    If you follow the conventional advice of using default as the main branch for development, then you should close your feature branch before you merge it back:

    $ hg update feature-branch
    $ hg commit --close-branch -m "Feature done, merging into default branch"
    $ hg update default
    $ hg merge feature-branch
    $ hg commit
    

    If you haven't done any work at all on the default branch since your started the feature branch, then this merge will be trivial and have no conflicts. Otherwise you'll have to resolve conflicts. If you're sure you want to keep everything from the feature branch, then you can do

    $ hg merge --noninteractive --tool internal:local feature-branch
    $ hg revert --all --rev feature-branch
    

    instead of just hg merge above. That will make sure that the new commit on default look exactly like the last commit on feature-branch.

提交回复
热议问题