Skip to content

Instantly share code, notes, and snippets.

@Dragod
Last active May 6, 2022 11:03
Show Gist options
  • Save Dragod/a638dcf8b8bcca6ec825837cb9d68d28 to your computer and use it in GitHub Desktop.
Save Dragod/a638dcf8b8bcca6ec825837cb9d68d28 to your computer and use it in GitHub Desktop.
Reverting The Working Copy to an Older Commit
# https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit#4114122
# Reverting The 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