如何挑选多个提交 [英] How to cherry-pick multiple commits
问题描述
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 hasb
,c
,d
,e
andf
on top ofa
. I want to movec
,d
,e
andf
to first branch without commitb
. Using cherry pick it is easy: checkout first branch cherry-pick one by onec
tof
and rebase second branch onto first. But is there any way to cherry-pick allc
-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屋!