billlee
2014-10-05 12:47:54 +08:00
这个状态还不算是一个新分支吧,叫做 detached 状态。如果你这时做了个 commit, 那么这个 commit 就是属于一个新分支的,但如果不给这个新分支命名,然后又 checkout 了其他分支,那么这个新分支的引用计数就变为0了,会被回收。
在新版本的 git 里应该是这样提示的:
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