This happens often in my work recently. For example, I was in the master branch, and I want to go back to a specific commit that I see from the 'git log' command. After I check out that previsou commit (for example, 6695724994), if I do 'git branch', I see this message.
ckim@ckim-ubuntu:~/prj/some/dir$ git branch
* (HEAD detached at 6695724994)
master
I thought 'git log' shows only commit in current branch, so I went to that previous commit, but why am I end up in a detached commit? What is the case?
git log <commit-id>
without needing to check it out first. Also, if the previous commit is still on your current branch, just looking at your current branch may be good enough, because you can view the current branch log and ignore the first commit with your eyes- the rest will be the same. You can also dogit log HEAD~1
if the desired commit is on your branch.