我已执行以下行以切换到我的队友创建的新分支:
git checkout with-backend
我收到以下错误:
错误:路径规范“with-backend”与 git 已知的任何文件不匹配
我尝试执行这个命令:
git branch -a
我的队友创建的 with-backend 分支未列出。以下是列出的结果:
* main
remotes/origin/HEAD -> origin/main
remotes/origin/main
git switch
(自 Git 2.23,2019 年第 3 季度开始)完成的,而不是 git checkout
(它试图同时管理文件和分支,使其变得令人困惑)
其次,
git switch with-backend
将在git fetch
之后起作用,因为如果它是“猜测”模式:
如果未找到
,但在一个远程(称为<branch>
)中确实存在一个具有匹配名称的跟踪分支,则视为相当于<remote>
$ git switch -c <branch> --track <remote>/<branch>
在开始工作之前,请确保始终从存储库中提取最新更改
git 获取<-- fetches all the latest changes from remote repo
或
git拉<-- It is one step ahead of git fetch, it fetches remote changes and also merge local branch with remote branch