1

I frequently do a git pull on a live server. If my website fails after a git pull, what is the command to go back to previous version of website which is stable?

Thanks

user845480
  • 11
  • 3
  • You should use `git pull --ff-only` to perform only fast-forward pulls (i.e. no conflicts and no merges necessary). Then you don't have to reset at all. – ThiefMaster Jul 14 '11 at 22:18

1 Answers1

6
git reset --hard ORIG_HEAD

or

git reset --hard HEAD@{1}

(see also here)

Community
  • 1
  • 1
Fred Foo
  • 355,277
  • 75
  • 744
  • 836
  • 2
    Or `git reset --hard HEAD@{1}`, which is easier to generalize (e.g. if you want to go back past two pulls). – Cascabel Jul 15 '11 at 00:46
  • How about seeing the logs and going back to a specific commit? – user845480 Aug 09 '11 at 17:11
  • @user845480: `git log` to check the logs, then copy-paste the SHA1 from there to get `git reset --hard `. – Fred Foo Aug 09 '11 at 19:48
  • Thanks. When I do git reset --hard , then that becomes my HEAD I think. I see it at the very top of the list when I do git log so I lost the commit after it? How can I go back to see the hashes after i.e. when I saw them on first git log command? – user845480 Aug 10 '11 at 11:17