Mercurial Rebase 场景 [英] Mercurial Rebase Scenario
问题描述
我已经阅读了 RebaseProject 页面并尝试了一个重要的例子(不是重新建立一个完整的分支).它类似于 rebase D on场景 B 的我.
I've read the RebaseProject page and tried a non-trivial example (not rebasing a complete branch). It's similar to the case rebase D on I of the scenario B.
这是rebase之前的情况:
Here's the situation before the rebase:
default : 0 ----- 2
\
feature : 1 ----- 3
现在我想在 2
上重新设置 3
,给出:
Now I'd like to rebase 3
on 2
, giving:
default : 0 ----- 2 ----- 3
\
feature : 1
不幸的是,RebaseProject 中没有给出确切的命令页面,但根据我对使用概要的理解,它应该是:
Unfortunately the exact commands aren't given in the RebaseProject page, but from my understanding of the usage synopsis it should be:
hg rebase --source 3 --dest 2
但不知何故,我的理解一定是有缺陷的,因为我得到了与合并相结合的变基:
But somehow my understanding must be flawed, because I get a rebase combined with a merge:
default : 0 ----- 2 ----- 3
\ /
feature : 1 -------
这是为什么?
重现场景的命令:
hg init
touch a
hg add a
hg commit -m "added a"
hg branch feature
touch b
hg add b
hg commit -m "added b on feature"
hg up -C default
touch c
hg add c
hg commit -m "added c on default"
hg up -C feature
echo "feature" >> a
hg commit -m "changed a on feature"
hg rebase --source 3 --dest 2
推荐答案
Your scenario looks very similar to part rebase G onto I
of scenario B
of the Rebase Project Scenarios:
场景 B
...
...
将 G 变基到 I
在你的场景中,D
== 1
, I
== 2
和 G
== 3
.变基后,3
保持与1
的关系,就像G'
保持与D
的关系一样.这是因为 D
不是 I
的祖先,并且:
In your scenario, D
== 1
, I
== 2
and G
== 3
. After rebasing, 3
maintains its relationship to 1
just like G'
maintained its relationship to D
. This is because D
is not an ancestor of I
and:
注意:仅当父级是目标的祖先时,Rebase 才会删除父级关系.
Note: Rebase drops a parent relationship only if the parent is an ancestor of target.
你真的想删除那个关系,然后,根据文档,你需要一个开发版本来获得 --detach
选项:
You really want to remove that relationship, then, according to the docs, you need a development version to get the --detach
option:
使用开发版本可以使用新的 --detach 选项来删除这种关系.
Using a development version is available the new --detach option that drops this relationship.
这篇关于Mercurial Rebase 场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!