How do I get the hash of the latest commit...
- when in detached HEAD state
- without specifying the branch explicitly
git rev-parse HEAD
and git log -n 1 --format="%H"
both follow the detached HEAD (obviously).
git rev-parse master
has me typing in the branch.
I'm guessing that the detached HEAD state has no notion of branches, but do you see my intention? I've been in master the whole time so I don't want to have to specify it explicitly just because I'm looking at a previous commit.
Same as this question but for detached HEAD state.
Thanks!