I have a remote git repository, and I need to roll back the last n commits into cold oblivion.
+5
A:
You can use git revert for all the n commits, and then push as usual.
Or you can git reset --hard HEAD~n and "git push -f", but that is not good for shared repositories, as you will break others work based on your branch.
elmarco
2009-02-25 23:51:17
I am glad it was clear enough :) thanks
elmarco
2009-02-26 00:19:33
+2
A:
elmarco is correct... his suggestion is the best for shared/public repositories (or, at least public branches). If it wasn't shared (or you're willing to disrupt others) you can also push a particular ref:
git push origin old_master:master
Or, if there's a particular commit SHA1 (say 1e4f99e in abbreviated form) you'd like to move back to:
git push origin 1e4f99e:master
Pat Notz
2009-02-26 00:43:21