mercurial - 如何将一些变更集移动到 Mercurial 中的新分支

标签 mercurial branch rebase

我想将变更集从一个分支移动到另一个分支。基本上,我目前有:

A -> B -> C -> D # default branch

我想要:

A # default branch
 \-> B -> C -> D # some_new_branch

其中 some_new_branch 尚不存在。我习惯了 git,所以我想我缺少一种简单的“mercurial”方式。

最佳答案

一种方法是导出 B、C、D 的补丁;更新为A;分支;应用补丁:

hg export -o patch B C D
hg update A
hg branch branchname
hg import patch

要从默认分支中删除 B、C、D,请使用 mq 扩展的 strip 命令。

关于mercurial - 如何将一些变更集移动到 Mercurial 中的新分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2219756/

相关文章:

Mercurial subrepo - 更改了 .hgsub 文件,但它仍然尝试从旧服务器中提取

git - 锁定 Git 分支

git - 如何放弃对分支所做的所有更改?

git - git 中存储库/分支的轻型版本

Git rebase master 和多个分支

git - 在 git 中重新定位功能分支后 merge

macos - Git rebase 错误 : This application will not run on your computer

eclipse - 如何将最常见的 mercurial 命令添加到 Eclipse 工具栏?

eclipse - Mercurial Eclipse 错误

mercurial:减少 hgrc 文件中的重复