看不到git远程分支

问题描述
git上已经有人建立分支branch170628_foo,希望在本地切换到该分支。但使用git命令切换分支时报错。

$ git checkout branch170628_foo
error: pathspec 'branch170628_foo' did not match any file(s) known to git.
查看远程分支,发现看不到目标分支。

解决方案
先用fetch命令更新remote索引。

$ git fetch
再查看remote分支,发现已经可以看到目标分支branch170628_foo。

$ git branch -a
再切换分支:

$ git checkout branch170628_foo

成功~

posted @ 2018-10-16 09:56  jiu~  阅读(5751)  评论(0编辑  收藏  举报