简体   繁体   English

对于Mercurial(hg),如果“ hg heads”显示3个heads但2个是branchs,如何将其删除?

[英]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? 现在hg heads只会显示1个头? Is this the proper way to close unused 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? 看起来如果我们再次hg up bugfix并更改一些文件并提交,那么该分支将自动重新打开,并且默认分支将再次显示2个头?

Is this the proper way to close unused branches? 这是关闭未使用的分支的正确方法吗?

Correct. 正确。 You can also use hg heads -c to show all branches. 您也可以使用hg heads -c显示所有分支。

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? 看起来如果我们再次拥抱bugfix并更改一些文件并提交,那么该分支将自动重新打开,并且默认分支将再次显示2个头?

Also correct. 也正确。 Newer versions of Mercurial will issue an information message about "reopening closed branch". 较新版本的Mercurial将发布有关“重新打开关闭的分支”的信息消息。

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. 尽管这是关闭未使用的分支的正确方法,但要意识到您通常不应该在Mercurial分支模型中关闭命名分支。

Generally speaking, small "feature branches" should be implemented either as anonymous branches or cloned repositories in mercurial. 一般而言,小型“功能分支”应实现为匿名分支或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) 在我的公司中,命名分支通常在分支后仅具有少量提交,并且总是存在严重的错误修正(请考虑安全性或重大数据完整性问题)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM