Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Revert Gist Commits

Revert / Undo a Gist Commit

It was not exactly obvious. Here's how to revert a Gist commit!

Checkout the gist like a normal git repo:

# replace the Gist ID with your own
git clone

Treat it like a normal repo. Edit, force push, etc.

Force Push

When you are ready, you will need to force push as the remote has newer commits:

git push -f origin master

Example: Revert the last commit to your Gist

Want to revert the last change?

git reset --hard HEAD~1 && git push -f origin master

Yay! You reverted!

Copy link

rainabba commented Oct 29, 2019

Just what I was needing!

Copy link

marco-souza commented Jun 21, 2021

Ty, works for me! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment