2

And previously, I tried to experiment with my program and then, I feel like going back (checkout) to previous commit. Then, I changed something, committed.. etc..

The question is, How do I go back to the state before I checkout.

I know I could git checkout the-hash,

But I don't know the-hash. git log only show history until the current state.

Thanks.

mechanical_meat
  • 163,903
  • 24
  • 228
  • 223
asdacap
  • 738
  • 2
  • 9
  • 15
  • 2
    Possible duplicate: [In Git, how do you see and manage commits that aren't in a branch?](http://stackoverflow.com/questions/1361127/in-git-how-do-you-see-and-manage-commits-that-arent-in-a-branch) – Pi Delport Oct 15 '10 at 17:00

1 Answers1

2

Take a look at the output of git reflog. Look for the checkout, then do a git checkout HEAD@{X} where X is the number that git reflog shows on the line after that checkout.

Jonathan
  • 13,354
  • 4
  • 36
  • 32