Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rednebmas/bae645d9f8d710451b63 to your computer and use it in GitHub Desktop.

Select an option

Save rednebmas/bae645d9f8d710451b63 to your computer and use it in GitHub Desktop.
Reset to previous commit without removing history
Reverting Working Copy to an Older Commit
To revert to a commit that's older than the most recent commit:
# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced
# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
# Updates working copy to reflect the new commit
git reset --hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment