Mercurial:创建分支而无需先进行更改
我听说在 Mercurial 存储库中创建分支的唯一方法是在工作副本中进行更改,然后将它们提交到新分支。
在 Subversion 中,我可以创建一个分支而无需进行更改(通过将 trunk
复制到 tags
下的路径) - 在 Mercurial 中也可以执行此操作吗?
我目前只见过 TortoiseHg,所以这可能只能通过命令行工具来完成,而我不知道。
我的工作流程是:
- 创建功能分支。
- 在该功能分支中做一些工作。
- 创建一个发布候选分支。
- 合并功能以发布候选分支。
- 部署、测试、修复部署、测试、修复候选版本分支。
- 将发布候选分支合并到主干。
非常感谢。
I heard that the only way to create a branch in a Mercurial repository is to make changes in the working copy, then commit them to a new branch.
In Subversion, I can create a branch without having to make changes (by copying trunk
to a path under tags
) - is it possible to do this in Mercurial as well?
I've currently only seen TortoiseHg, so it's possible this can only be done via the command-line tool and I don't know it.
My workflow for this is:
- Create feature branch.
- Do some work in that feature branch.
- Create a release candidate branch.
- Merge feature(s) to release candidate branch.
- Deploy, test, fix deploy, test, fix release candidate branch.
- Merge release candidate branch to trunk.
Many thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于你所说的分支是什么意思。
可以通过给它一个名称然后提交来创建命名分支,它将最终作为历史记录中的新变更集,但您不需要显式更改工作文件夹中的任何文件即可允许提交。
您还可以使用 TortoiseHg 对话框来执行此操作。
但是,如果您想创建另一个未命名的分支,即。只是另一个头,那么是的,你需要改变一些东西。实际上,为什么您只想创建一个没有任何更改的空变更集?只是为了表明“当我进行一些更改时,我会将分支放置在此处”?
It depends on what you mean by branch.
A named branch can be created by giving it a name and then committing, it'll end up as a new changeset in the history, but you don't need to explicitly change any of the files in the working folder to be allowed to commit.
You can also do this using the TortoiseHg dialog.
However, if you want to create another unnamed branch, ie. just another head, then yes, you need to change something. And really, why would you want to just create an empty changeset with no changes? Just to signal that "this is where I'll place my branch when I have some changes"?
您可能想查看书签扩展(它很快将成为 Mercurial 核心的一部分)。
如果您熟悉 git 中分支的工作方式,那么它几乎是一样的。
就像 git 中的分支一样,您可以创建书签而无需提交任何内容。
You might want to check out the bookmarks extension (which is soon to be part of core Mercurial).
If you're familiar with how branches work in git, then it's almost the same.
And just like branches in git, you may create a bookmark without committing anything.
创建分支后不要忘记使用以下命令推送它:
After creating the branch dont forget to push it with: