【发布时间】:2020-08-25 20:26:51
【问题描述】:
我创建了一个名为 test.txt 的文件。在其中,我从测试文件中的主分支内容进行了两次提交,分别是 1(第 1 次提交)和 2(第 2 次提交),我创建了一个功能分支,在其中我进行了 3 次提交,如下所示 3(第 3 次提交)), 4(第4次提交),5(第5次提交)。现在总共有5次提交,2个在master分支,3个在feature分支。
现在我只需要选择我在功能分支中的第四个提交。当我检查到主分支时,我正在输入 git cherry-pick commit-i'd。但它抛出的错误是
git cherry-pick bb87e7b
error: could not apply bb87e7b... Fourth Commit
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
我感觉到问题出在哪里......主分支没有第三次提交,哪个功能分支有。所以很明显,主分支中将缺少第三个提交内容。但根据cherry-pick的逻辑,我们应该能够以一种或另一种方式执行此操作。
如果有人知道答案,请详细解释,或者如果您需要任何支持文件来解决此错误,请在此处回复。我会在这里分享。谢谢!
【问题讨论】:
标签: linux git devops merge-conflict-resolution git-cherry-pick