views:

33

answers:

1

Hello. I'm using git.

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.

+1  A: 

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