简体   繁体   English

在Mercurial中使用不同的“路径”-也称为分支

[英]Using different “paths” in Mercurial - also called branching

Is it possible to have different development "paths" from a given point in Mercurial, without having to clone my project? 是否可以从Mercurial的给定点开始使用不同的开发“路径”,而不必克隆我的项目? I currently have 2-3 different implementations options for a project and I'd like to try them out. 我目前为一个项目提供2-3种不同的实现选项,我想尝试一下。 If I could just use one and at any point come back and start in another "path" without losing data from the older one that would be nice, but I am not even sure it is possible. 如果我可以只使用其中一个,并且随时返回并开始另一条“路径”,而不会丢失旧版本中的数据,那将是不错的选择,但是我什至不确定是否有可能。

Thanks 谢谢

This is exactly what branching is designed for: 这正是分支设计的目的:

https://www.mercurial-scm.org/wiki/Branch https://www.mercurial-scm.org/wiki/分支

The easiest way to create a branch in Mercurial is to simply checkout an older version, and then commit again with something different from what you committed after it the first time. 在Mercurial中创建分支的最简单方法是简单地签出较旧的版本,然后再次提交与第一次执行后提交的内容不同的内容。 You won't lose the old following commit, the new commit will simply branch out into a new line of development and the original commit(s) will remain on the previous line of development. 您将不会丢失旧的后续提交,新的提交将简单地分支到新的开发线中,而原始提交将保留在先前的开发线中。

Yes, you probably want bookmarks for this - they're a lightweight way of marking various heads without recording the names forever in the revision (which branches do.) See BookmarksExtension for more details. 是的,您可能需要为此添加书签-它们是一种标记各种标头的轻巧方式,而无需在修订版中永久记录名称(分支确实如此)。有关更多详细信息,请参见BookmarksExtension

http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/ may also be helpful - it's essentially the canonical document on branch management strategies in Mercurial. http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/也可能会有所帮助-本质上,这是有关Mercurial中分支机构管理策略的规范文档。

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

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