当我像这样签出branch2时,我在branch1上(两个分支都存在)。
git checkout origin/branch2
然后我得到了一个分离的头错误:
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.但是我只需要检查branch2 (没有origin),然后它就可以正常工作了:
git checkout branch2
那么,使用和不使用origin/的git checkout有什么区别?为什么在使用origin/时会出现detached HEAD错误?
发布于 2016-02-02 13:30:39
您应该使用git checkout --track origin/branch2创建branch2的本地分支,该分支跟踪远程origin/branch2
https://stackoverflow.com/questions/35145400
复制相似问题