Rolling back a remote Git repository

You can use git revert <commit>… for all the n commits, and then push as usual, keeping history unchanged.

Or you can “roll back” with git reset --hard HEAD~n. If you are pushing in a public or shared repository, you may diverge and break others work based on your original branch. Git will prevent you doing so, but you can use git push -f to force the update.

Leave a Comment