Skip to content

Instantly share code, notes, and snippets.

@stefanoortisi
Created June 13, 2013 14:40
Show Gist options
  • Save stefanoortisi/5774216 to your computer and use it in GitHub Desktop.
Save stefanoortisi/5774216 to your computer and use it in GitHub Desktop.
Revert a branch to a previous commit
# To revert to a commit further back than the most recent commit--------
git reset 56e05fced #resets index to former commit; replace '56e05fced' with your commit code
git reset --soft HEAD@{1} #moves pointer back to previous HEAD
git commit -m "Revert to 56e05fced"
git reset --hard #updates working copy to reflect the new commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment