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 of cherry-picking?
4 Answers
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.
-
8Has the --abort option been removed/added in a specific git version? I'm running git 1.7.4.1 and "git cherry-pick --abort" results in a git cherry-pick usage message. I also grepped "git help cherry-pick" for "abort" and didn't find anything. – danns87 Oct 30 '13 at 18:57
-
2@danns87 the `--abort` option became available at [version 1.7.8](https://github.com/git/git/blob/v1.8.4.2/Documentation/RelNotes/1.7.8.txt#L31-32). Is it possible for you to upgrade? – Oct 30 '13 at 19:38
-
7yes, this doesn't work. Most of the times I get this `error: Entry '
' not uptodate. Cannot merge.` On the other hand, `git reset --merge` does work! – kumarharsh Jun 04 '14 at 12:02 -
@KumarHarsh which version of Git are you using? – Jun 04 '14 at 12:03
-
1>1.8. Actually, it was because of dirty files in the directory. But the `git reset --merge` command works even then. – kumarharsh Jun 04 '14 at 20:10
-
The --abort option always worked for me until today, when it started a memory leak somehow. I watched my memory usage increase linearly to just short of maximum when the --abort command errored out with a calloc error. Trying variations on "git reset" produced the same result. Stuck, I found the only way to resolve the issue was to a̶d̶d̶ ̶m̶o̶r̶e̶ ̶m̶e̶m̶o̶r̶y̶ undo all changes made by the cherry-pick, and then attempt to abort it. – Greg Jun 05 '14 at 19:54
-
Is it possible to abort the cherry-pick, but keep the changes? I decided I want to amend the previous commit with the cherry-picked changes instead. – Qwerty Dec 30 '20 at 13:41
-
rror: Entry 'TimeFountain/Extensions/String+matrix.swift' not uptodate. Cannot merge. fatal: Could not reset index file to revision 'a6f60f1752e46f91259d93ec78b13dc836bff81f'. fatal: cherry-pick failed – ScottyBlades Feb 02 '21 at 01:03
I found the answer is git reset --merge
- it clears the conflicted cherry-pick attempt.

- 8,948
- 2
- 21
- 27
-
4Is it any different from `git reset --hard`? I'm using rebase workflow, if anything. It seems to work out for me. – x-yuri Aug 22 '14 at 10:03
-
4
For me, the only way to reset the failed cherry-pick-attempt was
git reset --hard HEAD

- 2,075
- 1
- 15
- 14
-
4This doesn't answer the question and only suggests an operation likely to destroy data. – martinkunev Jan 31 '20 at 09:43
-
1If your cherry-pick succeeded and you actually just want to revert the changes made by it, then this is the right answer, but be warned that it will lose any other changes you've made, not just ones due to the cherry-pick. – deed02392 Jun 30 '20 at 09:41
Try also with '--quit' option, which allows you to abort the current operation and further clear the sequencer state.
--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.
use help to see the original doc with more details, $ git help cherry-pick
I would avoid 'git reset --hard HEAD' that is too harsh and you might ended up doing some manual work.

- 354
- 2
- 10
-
1That shouldn't exist. Git is complicated enough without two ways of canceling a cherry pick that have subtly different effects on the repo state. – Kaz Oct 21 '19 at 19:25
-
True, it doesn't give me any error, but not not completely quitting the command state. – BJYC Oct 21 '19 at 19:35