Front-end - git checkout origin/dev Why is the switching branch on HEAD? What is HEAD?
phpcn_u15822017-05-31 10:36:00
0
1
1167
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
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.
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.