现象

使用命令切换到develop分支
$ git checkout develop
提示如下错误:
error: pathspec 'develop' did not match any file(s) known to git

解决

1、先看一下git的分支情况

$ git branch -a


* master
  remotes/origin/master

2、没有发现develop分支,则需要获取全部分支

git fetch

$ git fetch
From https://codeup.aliyun.com/fruits/pitaya/product/pex/pty-wit
 * [new branch]      develop    -> origin/develop

这时develop分支已经有了

$ git branch -a
* master
  remotes/origin/develop
  remotes/origin/master

3、切换到develop分支

$ git checkout develop
Switched to a new branch 'develop'
M       pty-wit-launch/pom.xml
Branch 'develop' set up to track remote branch 'develop' from 'origin'.


$ git branch -a
* develop
  master
  remotes/origin/develop
  remotes/origin/master


切换到远程develop分支
git checkout origin/develop

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐