Can't cherry pick (error)

左心房为你撑大大i 提交于 2019-12-13 10:39:00

问题


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

  • Commit to cherry-pick: https://github.com/CyanogenMod/android_device_lge_bullhead/commit/4c98c8df392dfb305d7ffe5deaf9a2bdf7824037

  • Error occurring:

    error: commit 4c98c8df392dfb305d7ffe5deaf9a2bdf7824037 is a merge but no -m option was given.
    fatal: cherry-pick failed
    
    Please help me, my repo is based off CM, has a different branch and is modified for a different ROM.

回答1:


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.



来源:https://stackoverflow.com/questions/41095143/cant-cherry-pick-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!