I have a remote git repository, and I need to roll back the last n commits into cold oblivion.
From stackoverflow
-
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 : I am glad it was clear enough :) thanks -
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:masterOr, if there's a particular commit SHA1 (say 1e4f99e in abbreviated form) you'd like to move back to:
git push origin 1e4f99e:masterrobertpostill : Great point about the SHA as a reference point!
0 comments:
Post a Comment