gpt4 book ai didi

Mercurial rebase 场景

转载 作者:行者123 更新时间:2023-12-03 06:56:21 24 4
gpt4 key购买 nike

我已阅读RebaseProject页面并尝试了一个不平凡的例子(不是对一个完整的分支进行 rebase )。这与 rebase D 的情况类似我场景B。

这是rebase之前的情况:

default : 0 ----- 2
\
feature : 1 ----- 3

现在我想在 2 上重新设置 3 的基础,给出:

default : 0 ----- 2 ----- 3
\
feature : 1

不幸的是,RebaseProject 中没有给出确切的命令。页面,但根据我对用法概要的理解,它应该是:

hg rebase --source 3 --dest 2

但不知怎的,我的理解一定是有缺陷的,因为我得到了与 merge 相结合的 rebase :

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

最佳答案

您的场景看起来与Rebase Project场景Brebase G into I部分非常相似场景:

Scenario B
...

scenario B originally
...

rebase G onto I

rebase G onto I

在您的场景中,D == 1I == 2G == 3。 rebase 后,3 保持与 1 的关系,就像 G' 保持与 D 的关系一样。这是因为 D 不是 I 的祖先,并且:

Note: Rebase drops a parent relationship only if the parent is an ancestor of target.

您确实想删除这种关系,那么,根据文档,您需要一个开发版本来获取--detach选项:

Using a development version is available the new --detach option that drops this relationship.

new --detach option

关于Mercurial rebase 场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4573916/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com