相关疑难解决方法(0)

Git中的HEAD是什么?

你看到Git文档说的话

分支必须在HEAD中完全合并.

但究竟Git HEAD究竟是什么?

git

956
推荐指数
14
解决办法
42万
查看次数

为什么使用显式refs/heads/branch的git checkout会给出分离的HEAD?

如果我仅使用分支名称签出分支,HEAD则更新为指向该分支.

$ git checkout branch
Switched to branch 'branch'
Run Code Online (Sandbox Code Playgroud)

如果我使用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
Run Code Online (Sandbox Code Playgroud)

为什么?如果它的版本依赖,我在Ubuntu 12.04.3上有git 1.7.9.5.

git git-checkout

17
推荐指数
1
解决办法
7879
查看次数

标签 统计

git ×2

git-checkout ×1