S.K
S.K

Reputation: 367

How to abort only the current git cherry-pick and not previous ones?

I have cherry picked multiple commits by doing git cherry-pick -x <SHA> and one of them failed (due to conflicts). I haven't pushed anything to the branch yet and I just want to abort the last cherry pick alone (the failed one) and keep everything else. Should I simply do git push to my branch and checkout all the files to discard the changes? Is there a command to abort just this?

git status shows something like this:

# On branch bugs-br # You are currently cherry-picking. 
#   (fix conflicts and run "git commit") 
# 
# Changes to be committed: 
# 
#       modified:  oper/svc/oper.cc 
# 
# Unmerged paths: 
#   (use "git add <file>..." to mark resolution) 
# 
#       both modified:    oper/svc_thread.cc

Upvotes: 0

Views: 3449

Answers (1)

joanis
joanis

Reputation: 12211

The command git cherry-pick --abort will only abort the last cherry pick you started. Previous complete cherry-pick operations are already committed, so they will not be affected.

So that's all you need to do at this point.

Upvotes: 4

Related Questions