Mercurial:如何在合并期间选择樱桃 [英] mercurial: how to cherry pick during merging

查看:72
本文介绍了Mercurial:如何在合并期间选择樱桃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下情况:

我有一个来自修订版4的分支br_foo.此后,默认分支上又进行了3个更改:6、7和8.我只想将更改7和8合并到br_foo中.有没有办法做到这一点?

I have a branch br_foo from revision 4. After that there are 3 more changes made on default branch: 6, 7 and 8. I'd like to only merge changes 7 and 8 to br_foo. Is there a way to achieve this in mercurial?

推荐答案

嫁接v移植

根据您使用的Mercurial版本,您可能会使用新的移植扩展中的功能适用于早期版本的Mercurial.

Graft v Transplant

Depending on which version of Mercurial you are using, you will probably use either the new Graft functionality in Mercurial 2.x or the older Transplant Extension for earlier versions of Mercurial.


这是最近宣布的(2011年11月),所以我自己没有机会与之合作.

This was announced recently (Nov 2011) so I haven't had a chance to work with it myself.

此命令使用Mercurial的合并逻辑来复制单个更改 而不合并历史图中的分支的其他分支. 有时称为回传"或采摘樱桃".经过 默认情况下,嫁接将从源复制用户,日期和描述 变更集.

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'. By default, graft will copy user, date, and description from the source changesets.


我只在这种情况下使用过它.描述中的小片段...

I've used it for just this scenario. A little snippet from the description ...

此扩展程序允许您从另一个分支或 存储库.

This extension allows you to transplant patches from another branch or repository.

它在移植的变更集中记录原始变更集ID, 并且避免移植以前移植的补​​丁.

It records the original changeset ID in the transplanted changeset, and avoids transplanting previously-transplanted patches.

它也可以用来根据上游的变化为分支建立基础 (包括删除已在上游采用的变更集),以 重写变更集并挑选一些变更集.

It can also be used to rebase a branch against upstream changes (including dropping changesets that have been adopted upstream), to rewrite changesets and to cherrypick some changesets.

这篇关于Mercurial:如何在合并期间选择樱桃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆