如果我这样做git checkout HEAD^
,我会得到这个:
$ 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...
$
资深 git 用户可能对此非常熟悉。但如果我这样做git checkout HEAD
,什么也不会发生:
$ git checkout HEAD
$
我想为当前分支头部的提交创建“分离的 HEAD”状态。我怎么做?