Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

android - Can't cherry pick (error)

I'm trying to cherry-pick a commit from CyanogenMod Github and having issue, here's more info:

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When cherry-picking a merge commit, you need to specify the mainline. The documentation:

-m parent-number

--mainline parent-number

Usually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline. This option specifies the parent number (starting from 1) of the mainline and allows cherry-pick to replay the change relative to the specified parent.

Consider the following commit log:

   B - C
  /     
A--D-E-F-G

Now, if you tell git to cherry-pick G, you are telling it: "Take the changes that commit G introduces". But that is ambiguous - in relation to commit C, G introduces changes made in D, E, and F. In relation to commit F, it introduces changes B and C.

To overcome this, you need to specify the mainline argument, which tells git whether C or F should be considered the mainline against which the comparison is done.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...