开发者

For Mercurial (hg), if "hg heads" show 3 heads but 2 are branches, how to remove it?

is the proper way to

hg up bugfix                # <-- use that branch
hg commit --close-branch
hg up another_branch        # <-- use another branch
hg commit --close-branch
hg up default

and now hg heads will only show 1 head? Is this the proper way to close unused branches?

Looks like if we hg up b开发者_如何学Pythonugfix again and change some file and commit, then that branch will automatically be re-opened and the default branch will show 2 heads again?


Is this the proper way to close unused branches?

Correct. You can also use hg heads -c to show all branches.

Looks like if we hg up bugfix again and change some file and commit, then that branch will automatically be re-opened and the default branch will show 2 heads again?

Also correct. Newer versions of Mercurial will issue an information message about "reopening closed branch".


While this is the proper way to close unused branches, do realize that you generally shouldn't be closing named branches in the mercurial branching model.

Generally speaking, small "feature branches" should be implemented either as anonymous branches or cloned repositories in mercurial.

Named branches are really designed for a different usecase, the case in which you would never close them. "Named branches are forever", and are a decent way of tracking bug-fix releases to code that has been released to the public. At my company, named branches typically only have a handful of commits after branching, and it's always bugfixes that are serious (think security or major data-integrity issues)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜