如何挑选多个提交 [英] How to cherry-pick multiple commits

查看:226
本文介绍了如何挑选多个提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个分支。提交 a 是一个的头部,而另一个具有 b c d e f on顶部 a 。我想将 c d e f 到第一个没有提交的分支 b 。使用樱桃挑选很容易:首先结账第一分支樱桃挑选 c f 第一。但是有没有办法在一个命令中挑选所有 c - f



以下是该场景的视觉描述(感谢:


git cherry-pick学会选择一系列的提交
(例如cherry-pick A..B和cherry-pick --stdin),所以git
还原;这些不支持更好的顺序控制rebase
[-i],尽管如此。


< blockquote>





包括重要评论(对各作者的评分)



注意1:在樱桃选A..B形式中,A应该比B早。如果它们的顺序错误, - damian



注2:另外,这不会挑选A,而是A之后的所有内容,包括B. - JB Rainsberger



注3:包含一个简单的类型git cherry-pick A ^ .. B - sschaef



I have two branches. Commit a is the head of one, while the other has b, c, d, e and f on top of a. I want to move c, d, e and f to first branch without commit b. Using cherry pick it is easy: checkout first branch cherry-pick one by one c to f and rebase second branch onto first. But is there any way to cherry-pick all c-f in one command?

Here is a visual description of the scenario (thanks JJD):

解决方案

Git 1.7.2 introduced the ability to cherrypick a range of commits. From the release notes:

git cherry-pick" learned to pick a range of commits (e.g. "cherry-pick A..B" and "cherry-pick --stdin"), so did "git revert"; these do not support the nicer sequencing control "rebase [-i]" has, though.


Including important comments (credits to respective authors)

Note 1: In the "cherry-pick A..B" form, A should be older than B. If they're the wrong order the command will silently fail. – damian

Note 2: Also, this will not cherry-pick A, but rather everything after A up to and including B. – J. B. Rainsberger

Note 3: To include A just type git cherry-pick A^..B – sschaef

这篇关于如何挑选多个提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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