1

I performed a

git log

and then I checked out a version about 10 versions back to poke around via...

git checkout akdsgh98afguafd7adfg34g4

Now, I want to go back to my most recent checkin. However, when I do a

git log

It only shows me versions older than the one I recently checked out. How do I get back to my most recent version?

chris P
  • 6,359
  • 11
  • 40
  • 84

2 Answers2

2

Checkout the other branch you were on before you started to poke around:

git checkout master
  • How can you checkout an older folder for a certain commit. For example, I don't want the entire commit, I just want /myDir/blah for a certain commit. – chris P Jun 28 '15 at 23:05
  • 1
    @chrisP Please ask a new question as a new question (preferably after searching), not as a follow-up to your current question. –  Jun 28 '15 at 23:08
1
git checkout master

Replace master with another branch name if you are not on the master branch. (Check which branch you are on with git branch)

You can also do

git checkout -

which will take you to the latest commit on the branch you are on.

bene
  • 151
  • 9
  • What if you can't remember what branch you were on (or you thought you were on `master`, but then you second-guess yourself thinking you might've accidentally been on some tmp branch like `throwaway`) Is there a history (even if only of length 1) of this kept somewhere? – jacobq Dec 19 '18 at 15:16