中止 git 樱桃挑选?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16820852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Abort a git cherry-pick?
提问by agmin
I ran git cherry-pick <hash>
and had merge conflicts. 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
. What's the equivalent for cherry-picking?
我跑了git cherry-pick <hash>
并且有合并冲突。我不想解决冲突,我只想中止挑选。在进行实际合并(与git merge
)时,有方便的git merge --abort
. 樱桃采摘的等价物是什么?
回答by
You can do the following
您可以执行以下操作
git cherry-pick --abort
From the git cherry-pick
docs
--abort
Cancel the operation and return to the pre-sequence state.
--abort
取消操作并返回前序状态。
回答by agmin
I found the answer is git reset --merge
- it clears the conflicted cherry-pick attempt.
我发现答案是git reset --merge
- 它清除了相互冲突的樱桃挑选尝试。
回答by Diego P. Steiner
For me, the only way to reset the failed cherry-pick-attempt was
对我来说,重置失败的樱桃挑选尝试的唯一方法是
git reset --hard HEAD
回答by Yu Chen
Try also with '--quit' option, which allows you to abort the current operation and furtherclear the sequencer state.
也可以尝试使用 '--quit' 选项,它允许您中止当前操作并进一步清除序列器状态。
--quit Forget about the current operation in progress. 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.
--quit 忘记当前正在进行的操作。可用于在樱桃挑选或恢复失败后清除音序器状态。
--abort 取消操作并返回前序状态。
use help to see the original doc with more details, $ git help cherry-pick
使用帮助查看包含更多详细信息的原始文档,$ 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' 太苛刻,你可能最终会做一些手工工作。