Skip to content

Instantly share code, notes, and snippets.

@omhmichaels
Forked from mgibowski/git-revert-sha-commit
Created April 5, 2022 17:44
Show Gist options
  • Save omhmichaels/2542b0379da7d3cf1b332f571485ba0c to your computer and use it in GitHub Desktop.
Save omhmichaels/2542b0379da7d3cf1b332f571485ba0c to your computer and use it in GitHub Desktop.
[git] revert to a commit by sha hash
# found at:
# http://stackoverflow.com/questions/1895059/git-revert-to-a-commit-by-sha-hash
# reset the index to the desired tree
git reset --hard 56e05fced
# move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment