- Open Terminal app and navigate to your local folder with the repo you would like to revert changes
- Selet the branch you would like revert by running
git checkout <branch-name-here>
- Run
git log --oneline
to see all of the commits - 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.
- Run
git revert --no-commit <commit-id>
To revert a range of commits, usegit revert --no-commit <start-range_commit-hash-id>..<end-range_commit-hash-id>
- Then run
git revert --continue
- A revert msg window will appear, update the message and follow the instratctions to save/exit the window.
- In your git history you should now see the revert commit and changes reverted from your local GIT repo
- Run
git push origin <branch-name>
to upload the latest changes to github.
Last active
April 12, 2020 17:23
-
-
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment