合并两个分支而不实际合并

发布于 2024-10-15 03:24:41 字数 245 浏览 2 评论 0原文

这看起来是一个相当常见和简单的要求,但我研究了移植扩展、变基、导入、导出等,但我还没有弄清楚。希望我错过了一些明显的事情。

我想“合并”两个分支(具体来说,称为分支),这样分支本身就不会消失。本质上,我想从修订中提取更改,但手动解决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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦里寻她 2024-10-22 03:24:41

我想“合并”两个分支(具体来说,称为分支),这样分支本身就不会消失。

这是默认行为。例如,如果您查看 Mercurial 源代码的 default 分支,您会看到它定期与 stable 合并。这些合并不会使 defaultstable 消失。合并提交仅获取本地分支名称。

我想手动确定进行哪些更改。

在我看来,移植已经做到了这一点。或者,您可以在其自己的功能分支上进行每个更改,然后您可以完全控制将哪些功能合并到分支中。

更新:现在还有一个核心移植 命令。

I would like to "merge" two branches (named branches, to be specific) such that the branches themselves don't go away.

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 with stable. These merges do not make default or stable disappear. The merge commit just gets the local branch name.

I want to manually determine what changes go in.

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.

听闻余生 2024-10-22 03:24:41

看起来您可以使用第三分支,即合并分支,您可以在其中合并其他两个分支中所需的任何变更集。
然后,您可以使用(此处适用于 Git)以下组合:

git cherry-pick SHA1 --no-commit
git add --patch

真正精确调整您需要在第三个分支中导入/合并的内容,如 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:

git cherry-pick SHA1 --no-commit
git add --patch

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'?"

森林迷了鹿 2024-10-22 03:24:41

如果您使用 git,请查看合并策略。

If you use git, take a look at merge strategies.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文