0

I have a Git repo that I'd like to roll back by about a dozen commits using...

git reset --hard d3289a7ab82fd76386d99bdd2c5e6496ecc62529

The problem is I've already pushed the commits to the remote.

How can I return everything including the remote to the state it was in at the specified commit?

Hauleth
  • 22,873
  • 4
  • 61
  • 112
Ethan
  • 57,819
  • 63
  • 187
  • 237

1 Answers1

1

Reset locally, then force the push to Github – your remote and local will be in identical states:

git reset --hard d3289a7ab82fd76386d99bdd2c5e6496ecc62529
git push -f
zeantsoi
  • 25,857
  • 7
  • 69
  • 61
  • 1
    This is not recommended if the commits have been pushed. Other repo users could have fetched and this will break their history. – johnsyweb Nov 07 '13 at 05:56
  • 1
    Very true, but the OP is asking how the remote can be rolled back while staying in sync with local. If local undergoes a hard reset (as the OP has indicated), the subsequent commits are effectively erased from history. It's fair, then, that those commits are flushed from remote as well. Also, we have no idea what the OP's Github repo is for – it may be for his/her own use alone. – zeantsoi Nov 07 '13 at 05:59
  • 1
    This can be also disallowed by remote. For example, on github you can't do that, if I'm not mistaken. – Max Yankov Nov 07 '13 at 07:54