Hou*_*Fat 5 git git-detached-head
这是我所有分支的列表:
$ git branch -a
* temp
remotes/heroku/master
remotes/origin/dev
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
当我键入 git checkout remotes/origin/master切换到我的原始master分支时,Git切换到分离的HEAD状态.为什么?
Cod*_*ard 11
这是正确的行为,因为您已签出远程分支.
如果您想查看主人并进行操作,您现在应该这样做:
# checkout remote branch as local branch
# this will look up the branch name locally and if it does not find it it
#will checkout your remote branch with this name.
git checkout master
Run Code Online (Sandbox Code Playgroud)
当您签出远程分支时,您只需将HEAD指向此分支的最新提交.如果您希望使用它,您必须将其作为本地分支进行检查,而不是remote/<branch>.这将自动签出并使用给定名称创建本地分支.
分离的HEAD意味着您的HEAD指向的提交不是提交链中的lates.
在此示例中,提交#4是最新的,而HEAD指向提交#2.
| 归档时间: |
|
| 查看次数: |
4560 次 |
| 最近记录: |