git error when switching branches
Switch branches:
[root@git my_code]# git checkout master
The following error is generated:
error: pathspec 'master' did not match any file(s) known to git.
Solution:
1. Check the branch status:
[root@git my_code]# git branch -a
2. If you don’t see the branch you want, get all branches first:
[root@git my_code]# git fetch
3. Check the branch situation again at this time
[root@git my_code]# git branch -a
You can see that the branch we want is displayed
4. Switch branches
[root@git my_code]# git checkout master
[root@git my_code]# git branch --list
At this point, the branch switch is successful and the problem is solved.