How to get back to the latest commit after checking out a previous commit?
I sometimes check out some previous versions 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. How git checkout last commit ?
If the commit (that you need to return) is known and you want that to attach with the head of some branch then use:
git checkout
And also you can see the commits that your HEAD has previously pointed to by using:
git reflog
For the latest versions of git, if you had done any checkouts something to moving your HEAD
You can also do:
git checkout -
This will take you back to the previous checkout. Thus, you can go back to the latest commits after checking out a previous commit.