合并两个分支而不实际合并
这看起来是一个相当常见和简单的要求,但我研究了移植扩展、变基、导入、导出等,但我还没有弄清楚。希望我错过了一些明显的事情。
我想“合并”两个分支(具体来说,称为分支),这样分支本身就不会消失。本质上,我想从修订中提取更改,但手动解决cherrypick更改/冲突(使用我的合并程序)。
似乎导入、导出、移植等都会生成直接应用于当前工作目录的补丁和变更集。但我不希望这样......相反,我想手动确定进行哪些更改。
感谢您的帮助。
This looks like a fairly common and straightforward requirement, but I've looked into transplant extension, rebase, import, export, etc, and I have yet to figure it out. Hopefully I am missing out something obvious.
I would like to "merge" two branches (named branches, to be specific) such that the branches themselves don't go away. Essentially, I want to pull changes from a revision but manually resolve cherrypick changes/conflicts (using my merge program).
It seems that import, export, transplant, etc generate patches and changesets that are directly applied to the current working directory. But I don't want that... instead, I want to manually determine what changes go in.
Appreciate your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是默认行为。例如,如果您查看 Mercurial 源代码的
default
分支,您会看到它定期与stable
合并。这些合并不会使default
或stable
消失。合并提交仅获取本地分支名称。在我看来,移植已经做到了这一点。或者,您可以在其自己的功能分支上进行每个更改,然后您可以完全控制将哪些功能合并到分支中。
更新:现在还有一个核心移植 命令。
This is the default behavior. For example, if you look at the
default
branch of the mercurial source code, you'll see that it regularly merges withstable
. These merges do not makedefault
orstable
disappear. The merge commit just gets the local branch name.Sounds to me like transplant already does that. Alternatively, you can make each change on its own feature branch and then you have full control over which features get merged into a branch.
update: there is now also a core graft command.
看起来您可以使用第三分支,即合并分支,您可以在其中合并其他两个分支中所需的任何变更集。
然后,您可以使用(此处适用于 Git)以下组合:
真正精确调整您需要在第三个分支中导入/合并的内容,如 SO 问题“使用 GIT,如何有选择地从另一个“fork”中提取/合并更改?”
It looks like you could use a third branch, a consolidation branch, where you can merge whatever changeset you need from the other two branches.
You can then use (here for Git) a combination of:
to really fine-tune exactly what you need to import/merge in that third branch, as described in the SO question "Using GIT, how can I selectively pull / merge changes from anothers 'fork'?"
如果您使用 git,请查看合并策略。
If you use git, take a look at merge strategies.