GIT cherry-pick 给出错误
GIT cherry-pick giving error
我正在尝试使用 sha 挑选其中一个提交到我的分支,但它给出了错误。
假设我在分支x
,那么我在我的终端运行命令git cherry-pick as560aad0138....
。
我得到的错误是这样的;
error: Commit as560aad0138.... is a merge but no -m option was given.
fatal: cherry-pick failed
答案就在错误消息中。
来自man git cherry-pick
:
[...]
-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.
[...]
我正在尝试使用 sha 挑选其中一个提交到我的分支,但它给出了错误。
假设我在分支x
,那么我在我的终端运行命令git cherry-pick as560aad0138....
。
我得到的错误是这样的;
error: Commit as560aad0138.... is a merge but no -m option was given.
fatal: cherry-pick failed
答案就在错误消息中。
来自man git cherry-pick
:
[...] -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. [...]