本文翻译自:Abort a git cherry-pick?
I ran git cherry-pick <hash>
and had merge conflicts. 我运行git cherry-pick <hash>
并发生合并冲突。 I don't want to resolve the conflicts, I just want to abort the cherry-pick. 我不想解决冲突,我只是想中止选择。 When doing an actual merge (with git merge
) there's the handy git merge --abort
. 在进行实际合并(使用git merge
)时,有方便的git merge --abort
。 What's the equivalent for cherry-picking? 摘樱桃等于什么?
#1楼
参考:https://stackoom.com/question/18Zs4/中止git-pick-pick
#2楼
我发现答案是git reset --merge
它清除了冲突的选择尝试。
#3楼
You can do the following 您可以执行以下操作
git cherry-pick --abort
From the git cherry-pick
docs 来自git cherry-pick
文档
--abort
Cancel the operation and return to the pre-sequence state. 取消操作并返回到先序状态。
#4楼
对我来说,重置失败的Cherry-Pick-attempt的唯一方法是
git reset --hard HEAD
#5楼
Try also with '--quit' option, which allows you to abort the current operation and further clear the sequencer state. 也可以尝试使用“ --quit”选项,该选项使您可以中止当前操作并进一步清除音序器状态。
--quit Forget about the current operation in progress. --quit忘记当前正在进行的操作。 Can be used to clear the sequencer state after a failed cherry-pick or revert. 失败后,可以用来清除音序器的状态。
--abort Cancel the operation and return to the pre-sequence state. --abort取消操作并返回到先序状态。
use help to see the original doc with more details, $ git help cherry-pick 使用help查看更多细节的原始文档,$ git help cherry-pick
I would avoid 'git reset --hard HEAD' that is too harsh and you might ended up doing some manual work. 我会避免使用'git reset --hard HEAD',它太苛刻了,您可能最终需要做一些手动工作。