gpt4 book ai didi

mercurial - 在 Mercurial 中,hg 嫁接和 hg rebase 有什么区别

转载 作者:行者123 更新时间:2023-12-03 09:24:26 28 4
gpt4 key购买 nike

我知道Rebase是(捆绑的)扩展,而 Graft是一项核心功能(取代了 Transplant(捆绑)扩展)。

graft 记录为:

copy changes from other branches onto the current branch

This command uses Mercurial's merge logic to copy individual changes from other branches without merging branches in the history graph. This is sometimes known as 'backporting' or 'cherry-picking'.



rebase 记录为:

Rebase allows moving commits around in Mercurial's history (using a series of internal merges). This has many uses:

  • moving changesets between branches
  • "linearizing" history
  • reordering changesets
  • collapsing multiple changes into one changeset


两者似乎都使用 merge 在分支之间移动或复制变更集。

移植副本。 rebase Action 。但是 rebase --keep副本。

很多时候,我似乎可以通过任何一种方式实现复制变更集的目标。
我用哪一个有关系吗?我什么时候应该更喜欢其中一个?

例如。应该只在复制到不同的命名分支时使用嫁接吗?或者只有当只有一个变更集时?

编辑:可能 rebase 是嫁接的潜在不安全超集,但只能与 draft 一起使用开发过程中用于编辑本地历史的变更集,而嫁接是 rebase 的安全子集,可与 public 一起使用维护期间的变更集以进行反向移植?

最佳答案

hg graft正如您在问题中指出的那样,允许“ cherry-pick ”。例如,您可以运行 hg graft -D "2085::2093 and not 2091"仅复制另一个修订版的一些更改。相比之下,hg rebase (有或没有 --keep )将获取您指定的任何变更集及其所有后续变更。

另外,rebase允许您折叠变更集(使用 --collapse )。据我所知,graft才不是。

我注意到的另一个区别:hg graft --edit 123允许您将修订版 123 移植到工作目录并编辑提交消息。我找不到 hg rebase相等的。不过,我应该指出,hg histedit还允许在 rebase 时编辑提交消息。

可能还有其他我没有想到的差异。 SO 社区:请随时在评论中指出这些内容,我会很乐意修改此答案以使其更完整。

the graft documentationthe Rebase Extension documentation更多细节。

关于mercurial - 在 Mercurial 中,hg 嫁接和 hg rebase 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29539866/

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