2

I am on master branch, I use cherry-pick merged one commit from another branch:

On master branch, I cherry-pick the commit by:

git cherry-pick -x e89d1

There was no conflicts after cherry-pick. There was no other commits in master branch after this cherry-pick.

Now, I want to undo that cherry-pick, what is the correct way to abort this cherry-pick?

My git version is 2.6.2

Leem.fin
  • 40,781
  • 83
  • 202
  • 354
  • Possible duplicate of [How to revert Git repository to a previous commit?](http://stackoverflow.com/questions/4114095/how-to-revert-git-repository-to-a-previous-commit) – Mykhailo Oct 25 '16 at 16:36

1 Answers1

3

Just reset your branch to previous commit:

git reset --hard HEAD~

Cherry-picked commit will remain there but it won't be visible because no branch or tag will point to it.

Eventually it will be removed by git garbage collector.

Paul
  • 13,042
  • 3
  • 41
  • 59