tags:

views:

42

answers:

2

I sometimes check out some previous version of the code to examine or test. I have seen instructions on what to do if I wish to modify previous commits -- but suppose I make no changes. After I've done e.g. git checkout HEAD^, how do I get back to the tip of the branch?.. git log no longer shows me the SHA of the latest commit.

+1  A: 

Have a look at the graphical gui ... gitk it shows all commits. Sometimes it is easier to work graphcal ... ^^

tanascius
yes, this is actually how I've done it in the past -- but I don't have the GUI available at the moment
Leo Alekseyev
+6  A: 

If you know the commit you want to return to is the head of some branch, or is tagged, then you can just

git checkout branchname

You can also use git reflog to see what other commits your HEAD (or any other ref) has pointed to in the past.

Novelocrat
wow, I was going to post the exact same answer! just when I was about to post it, the orange bar popped up telling me you beat me to it :P
hasen j
Wow, this is so obvious in hindsight. Thanks!
Leo Alekseyev