On a local repo, I\'ve just executed git cherry-pick SHA
without any conflicts or problems. I then realized I didn\'t want to do what I just did. I have not pushed
Faced with this same problem, I discovered if you have committed and/or pushed to remote since your successful cherry-pick, and you want to remove it, you can find the cherry-pick's SHA by running:
git log --graph --decorate --oneline
Then, (after using :wq
to exit the log) you can remove the cherry-pick using
git rebase -p --onto YOUR_SHA_HERE^ YOUR_SHA_HERE
where YOUR_SHA_HERE
equals the cherry-picked commit's 40- or abbreviated 7-character SHA.
At first, you won't be able to push your changes because your remote repo and your local repo will have different commit histories. You can force your local commits to replace what's on your remote by using
git push --force origin YOUR_REPO_NAME
(I adapted this solution from Seth Robertson: See "Removing an entire commit.")