fatal: Cannot update paths and switch to branch 'gitlab' at the same time.
I believe this occurs when you are trying to checkout a remote branch that your local git repo is not aware of yet. Try:
git remote show origin
If the remote branch you want to checkout is under “New remote branches” and not “Tracked remote branches” then you need to fetch them first:
git remote update
git fetch
Now it should work:
git checkout -b local-name origin/remote-name
还有一种方法:
直接执行如下命令:
git fetch --all && git fetch -t