git - 错误: commit is a merge but no -m option was given

标签 git

当我做git cherry-pick时,出现此错误,我该如何解决?

$ git cherry-pick  XXXXXXXXXXXXX                                                                                                                                          
error: commit XXXXXXXXXXXXX is a merge but no -m option was given.
fatal: cherry-pick failed
$ git cherry-pick
    -m, --mainline <n>    parent number
$ git cherry-pick -m 1234 XXXXXXXXXXXXX
$ error: commit XXXXXXXXXXXXX does not have parent 1234
fatal: cherry-pick failed

最佳答案

我认为帮助/手册页非常清楚地说明了为什么需要-m参数,并且错误消息清楚地说明了您需要它:

-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.

关于git - 错误: commit is a merge but no -m option was given,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41842149/

相关文章:

git - 如何在通过 Git 使用 Vimdiff 时获取 bufspec

git - `git` 和 `less` 集成在 OS X 终端 : prevent writing output of `less` to tty

git fetch --quiet 正在写入标准输出而不是保持沉默

android - android 中 phonegap 的 urbanairship 通知插件问题

java - 我如何从 java 运行 git 命令?

git - 如何将主分支恢复到上游

git - 仅为一次提交设置用户数据

git - 请改用个人访问 token 。 (但使用一个)

git - 有没有办法以编程方式获取私有(private) github repo 的 zipball?

git - 如何完全替换git存储库中的代码