git切换分支报错:error: pathspec 'origin/XXX' did not match any file(s) known to git.

git切换分支报错:error: pathspec ‘origin/XXX’ did not match any file(s) known to git.

项目上有一个分支XXX,使用git branch -a看不到该远程分支,直接使用命令git checkout XXX报错如下:

error: pathspec ‘origin/XXX’ did not match any file(s) known to git.
解决方法:
1、执行命令git fetch取回所有分支的更新

2、执行git branch -a可以看到XXX分支(已经更新分支信息)

3、切换分支git checkout XXX

你可能感兴趣的:(git)