git checkout error when switching branch.

来源:互联网 发布:mac 剪裁mp3 编辑:程序博客网 时间:2024/05/17 01:28
git checkout -b local-name origin/remote-name

fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/remote-name' which can not be resolved as commit?

sloving way:

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
0 0