git checkout origin/dev Why is the switch branch on HEAD and not on dev?
apple$ git checkout origin/dev
HEAD is now at 8047e0c... merge
apple$ git branch
* (HEAD detached from 1fd4922)
dev
feature/project
feature/supply
master
黄舟2017-05-31 10:38:00
1. HEAD is similar to the head pointer of a linked list. It can also be understood as the top pointer of the stack. It points to the latest record of your local branch. You need to understand it yourself.
2. The reason why you did not switch to dev is because your command is incorrect, not the command to switch to dev.
It can be seen from brach that you already have dev locally. If you want to switch to dev, the command should be: git checkout dev
.
And git checkout origin/dev
means to point the local git head pointer to the dev branch of the origin library. Origin is not your local, it can only point to its id, and cannot be cut through.