Если я извлекаю ветку, используя только имя ветки, HEAD
обновляется, чтобы указывать на эту ветку.
$ git checkout branch
Switched to branch 'branch'
Если я извлекаю ветку с помощью refs/heads/branch
или heads/branch
, HEAD
отсоединяется.
$ git checkout refs/heads/branch
Note: checking out 'refs/heads/branch'.
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.
$ git checkout "refs/heads/branch"
Same result
$ git checkout heads/branch
Same result
Почему? Если его версия зависит, у меня есть git 1.7.9.5 на Ubuntu 12.04.3.