我有两个分支develop和master。假设master落后于大约 20 次提交。我只想将其中一个提交(07f5722)从develop合并到master。我怎样才能做到这一点?
如何在 git 中合并特定提交以及如何在 Git 中将特定提交从一个分支合并到另一个分支?两者都说要使用git cherry-pick
,而没有过多解释您应该如何使用它。我也没有真正遵循手册页中的示例。
我尝试执行以下操作:
git checkout -b merge-07f5722 develop
git cherry-pick 07f5722
但收到有关樱桃采摘为空的消息:
On branch merge-07f5722
You are currently cherry-picking commit 07f5722.
nothing to commit, working directory clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
If you wish to skip this commit, use:
git reset
Then "git cherry-pick --continue" will resume cherry-picking
the remaining commits.
git cherry-pick not working的答案表明这意味着cherry-pick 是没有实际更改的无操作。好的,那么我如何获得更改?
注意:我的问题与git cherry-pick not working几乎相同。但是,我想知道如何完成我打算做的事情,而不是为什么我尝试的命令特别失败。
我必须使用的命令序列是:
git checkout -b merge-07f5722 master
git cherry-pick 07f5722 # commit from develop
git checkout master
git merge merge-07f5722