看不到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

成功~


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM