将代码从一个分支添加到另一个分支时,Git cherry-pick 命令不起作用

问题描述

我有 3 个分支开发、备份和发布。备份是从开发创建的,发布是从备份创建的。现在我在开发中有新的变化。只有一个提交应该进入发布分支。所以我试图从开发到备份使用cherry-pick,然后从备份到发布使用新的 PR,但是我在做同样的事情时遇到了错误

我正在尝试从一个分支到另一个分支使用cherry-pick,但出现以下错误

E:\Java\Projects\Test-db\Test_db>git cherry-pick 876c951b5012e4ab87a9be9521
error: Commit 876c951b5012e4ab87a9be9521 is a merge but no -m option was given.
fatal: cherry-pick Failed

然后通过查看此链接 [https://stackoverflow.com/questions/12626754/git-cherry-pick-Syntax-and-merge-branches/12628579] 我尝试了 -m 与cherrypick 命令但得到关注>

E:\Java\Projects\Test-db\Test_db>git cherry-pick -m 1 876c951b5012e4ab87a9be9521
On branch Java-develop-backup-2021-01-20
You are currently cherry-picking commit 876c951.

Untracked files:
        mvn

nothing added to commit but untracked files present
The prevIoUs cherry-pick is Now empty,possibly due to conflict resolution.
If you wish to commit it anyway,use:

    git commit --allow-empty

Otherwise,please use 'git reset'

E:\Java\Projects\Test-db\Test_db>

我试过 git commit --allow-empty 但它正在打开以下

#
# It looks like you may be committing a cherry-pick.
# If this is not correct,please remove the file
#       .git/CHERRY_PICK_HEAD
# and try again.


# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored,and an empty message aborts the commit.
#
# Author:    ABC Rokade <ABC.rokade@testcompnay.com>
# Date:      Wed Jan 20 14:49:10 2021 +0000
#
# On branch Java-develop-backup-2021-01-20
# You are currently cherry-picking commit 876c951.
#
# Untracked files:

我不确定还需要做什么。您能帮我解决使用简单的cherry-pick 命令时出现的错误吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)