本文介绍了将一些提交移到Hg的新分支中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的仓库目前如下:

O 7: default
|
O 6: default
|
|  O 5: default
|  |
|  O 4: default
|  |
|  O 3: default
| /
O 2: default
|
O 1: default

我想将6和7移到新分支,该怎么办?

I would like to move 6 and 7 to a new branch, how can I do it?

推荐答案

您可以使用 rebase扩展为此.需要启用它,但是该链接包含有关如何执行操作的信息.

You can use the rebase extension for this. It needs to be enabled but that link has the information on how to do it.

命令为:

hg update 2
hg branch newbranch
hg commit -m "Creating new branch"
hg rebase -s 6 -d 8

这将创建新分支,将其提交(在您的示例中将创建版本8),然后将版本6及其后代移动到新分支上.显然,您需要查找存储库的实际修订号.

This creates the new branch, commits it (which would create revision 8 in your example) and then moves revision 6 and its descendants onto the new branch. Obviously, you'd need to look up the actual revision numbers for your repository.

您也可以使用 mq扩展名来做到这一点,但我认为rebase更易于使用在这种情况下.

You could also do it with the mq extension but I think that rebase is easier to use in this instance.

这篇关于将一些提交移到Hg的新分支中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 20:03