Skip to content

Instantly share code, notes, and snippets.

@imghasemi
Created August 15, 2019 09:50
Show Gist options
  • Save imghasemi/5b50c714cb17de0a115a7d331647c5a5 to your computer and use it in GitHub Desktop.
Save imghasemi/5b50c714cb17de0a115a7d331647c5a5 to your computer and use it in GitHub Desktop.

In order to undo changes to the HEAD we can simply run following command:

git reset --hard HEAD~ 

REF: https://stackoverflow.com/a/30986481

A cherry-pick is basically a commit, so if you want to undo it, you just undo the commit.

when I have other local changes Stash your current changes so you can reapply them after resetting the commit.

git stash
git reset --hard HEAD^
git stash pop  # or `git stash apply`, if you want to keep the changeset in the stash

when I have no other local changes

git reset --hard HEAD^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment