If I do git checkout HEAD^
, I get this:
$ git checkout HEAD^
Note: checking out 'HEAD^'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at...
$
Veteran git users are probably very familiar with this. But if I do git checkout HEAD
, nothing happens:
$ git checkout HEAD
$
I'd like to create the "detached HEAD" state for the commit at the head of my current branch. How do I do that?