git reset --soft and going back to the latest commit

So I just did a git --reset soft to go back to a previous commit. Now what if I want to go back to the latest commit that I was at before? i.e: the latest commit? I tried doing git log, but the commit listed there didn't have the latest commit.


git reset is the wrong tool to use if you just want to go back and look at an old commit, since in many modes it actually alters the history by removing commits, as you've discovered.

If you want to temporarily get an old commit back in your working tree, just use git checkout. In this case, git checkout HEAD^ will take you back one commit. git checkout HEAD~3 will take you back three commits, and so on. Or you can give it the hash from git log.

You can then return to the latest commit by doing git checkout master (replacing master with the name of any branch).

Do you want to basically undo your reset? It's not going to show up in your git log because you reverted it from that. However it will show up in your

git reflog

This will give you a listing of all your different branches.

git reset HEAD@{1}

Should fix your problem if your reset was the last thing you did.

Need Your Help

Overriding multiple config values in Typesafe config when using an uberjar to deploy

scala deployment sbt akka typesafe-config

I've an Akka application which uses multiple configuration values (IP address, port numbers) defined in resource/application.conf. I'm using the sbt-assembly plugin to create an uber jar and then

JavaScript Drag & Select functionality done right

javascript jquery jquery-ui selection drag

I'm trying to write a drag & select functionality using HTML & JavaScript. By that I mean that there will be a set of objects with arbitrary absolute positions. I want to be able drag the c...