Mercurial中的追溯命名分支 [英] Retroactive named branching in Mercurial

查看:71
本文介绍了Mercurial中的追溯命名分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以将一堆Mercurial变更集与已提交的命名分支关联起来(即追溯)?

Is there a way to associate a bunch of Mercurial changesets with a named branch after they have been committed, i.e. retroactively ?

推荐答案

我只是想这样做,这是我找到的解决方案. 自最初提出该问题以来已经过去了一年,这也许可以解释为什么我现在可以找到一个解决方案. 缺点是您在此过程中创建了一个额外的修订,但这对我来说还不错.

I just wanted to do this, and here’s the solution I found. A year has passed since the question was originally asked, this might explain why I can now find a solution. It has the disadvantage that you create an extra revision in the process, but this wasn’t too bad for me.

首先,您回到要创建分支的位置. 就我而言,我实际上是想开始一个新的根目录(因为启动存储库时我不是很明智,但是无论如何),所以我要更新为null.您可能想从其他地方开始,这取决于您的情况.

First, you go back to where you want to create the branch. In my case, I actually wanted to start a new root (because I wasn’t very sensible when I started the repository, but anyways), so I’m updating to null. You probably want to start somewhere else, it depends on your situation.

$ hg update null

然后,创建分支.

$ hg branch blah
$ hg commit -m "Created blah branch."

然后,我们将所有提交的内容重新建立到新分支上:

Then, we rebase all the commits we made onto our new branch:

$ hg rebase -s SOURCE -d DEST

此处的SOURCE应该是您要创建分支的提交中的第一个提交,DEST应该是创建分支的提交(我们在上面提交的提交).

The SOURCE here should be the first commit you made in the commits you want to create the branch from, and the DEST should be the commit where the branch was created (the one we committed above).

这篇关于Mercurial中的追溯命名分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆