How to Conclude a Git Cherry-Pick?
Solved with the following: rm .git/CHERRY_PICK_HEAD
I realize this is dangerous as this doesn't guarantee internal consistency within git, but no issues for me so far...
Since my previous answer from 2014, the proper command nowadays (2018) is git cherry-pick --quit
.
And before Git 2.19 (Q3 2018), "git cherry-pick --quit
" failed to remove CHERRY_PICK_HEAD
even though we won't be in a cherry-pick session after it returns, which has been corrected.
See commit 3e7dd99 (16 Aug 2018) by Nguyễn Thái Ngọc Duy (pclouds
).
(Merged by Junio C Hamano -- gitster
-- in commit 39e415c, 20 Aug 2018)
cherry-pick: fix --quit not deleting CHERRY_PICK_HEAD
--quit
is supposed to be--abort
but without restoringHEAD
.
LeavingCHERRY_PICK_HEAD
behind could make other commands mistake thatcherry-pick
is still ongoing (e.g. "git commit --amend
" will refuse to work). Clean it too.For
--abort
, this job of deletingCHERRY_PICK_HEAD
is on "git reset
" so we don't need to do anything else. But let's add extra checks in--abort
tests to confirm.
Next time try git cherry-pick --abort
, otherwise what you did should more or less work.