对于 Mercurial (hg),如果“hg head”为显示有3个头,但有2个是树枝,如何去除?
是正确的方法
hg up bugfix # <-- use that branch
hg commit --close-branch
hg up another_branch # <-- use another branch
hg commit --close-branch
hg up default
,现在 hg faces
只会显示 1 个头?这是关闭未使用的分支的正确方法吗?
看起来如果我们再次hg up bugfix
并更改一些文件并提交,那么该分支将自动重新打开并且默认分支将再次显示2个头?
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 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正确的。您还可以使用 hg Heads -c 来显示所有分支。
也正确。较新版本的 Mercurial 将发出有关“重新打开关闭的分支”的信息消息。
Correct. You can also use
hg heads -c
to show all branches.Also correct. Newer versions of Mercurial will issue an information message about "reopening closed branch".
虽然这是关闭未使用的分支的正确方法,但请注意,您通常不应该关闭 Mercurial 分支模型中的命名分支。
一般来说,小的“功能分支”应该作为匿名分支或 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.
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)