Skip to content

Instantly share code, notes, and snippets.

@dompascal
Last active April 12, 2020 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dompascal/438a841e16374364894e929bab679ab6 to your computer and use it in GitHub Desktop.
Save dompascal/438a841e16374364894e929bab679ab6 to your computer and use it in GitHub Desktop.
Use GIT revert if you would like to remove specific git commits from your repo. If you would like to revert to a specific commit, GIT reset is a better option for you.
  1. Open Terminal app and navigate to your local folder with the repo you would like to revert changes
  2. Selet the branch you would like revert by running git checkout <branch-name-here>
  3. Run git log --oneline to see all of the commits
  4. On the left each commit has a hash ID, find the commit you would like to revert to and highlight and copy that ID to the clipboard.
  5. Run git revert --no-commit <commit-id> To revert a range of commits, use git revert --no-commit <start-range_commit-hash-id>..<end-range_commit-hash-id>
  6. Then run git revert --continue
  7. A revert msg window will appear, update the message and follow the instratctions to save/exit the window.
  8. In your git history you should now see the revert commit and changes reverted from your local GIT repo
  9. Run git push origin <branch-name> to upload the latest changes to github.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment