我克隆了一个远程分支.我如何结帐主人? [英] I cloned a remote branch. How do I checkout master?

查看:72
本文介绍了我克隆了一个远程分支.我如何结帐主人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我克隆了一个远程分支 git clone-单分支--branch< branchname>< remote-repo>.现在我要结帐主人.当我尝试 git checkout master 时,出现以下错误消息: error:pathspec'master'与git 已知的任何文件都不匹配.如何检出master而不需要单独克隆它?

I cloned a remote branch with git clone --single-branch --branch <branchname> <remote-repo> . Now I want to checkout master. When I try git checkout master I get this error message: error: pathspec 'master' did not match any file(s) known to git. How do I checkout master without having to clone it separately?

推荐答案

来自

进一步提取到结果存储库中只会将该选项用于初始克隆的分支更新远程跟踪分支."

"Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning."

恐怕没有选择,您将不得不重做.

You'll have to reclone without the option I'm afraid.

请注意,远程跟踪分支不是本地分支.重新克隆不会为每个远程分支创建本地分支,即使没有 -单分支

Note that remote-tracking branches are not local branches. Recloning won't create a local branch for each remote one, even without --single-branch

这篇关于我克隆了一个远程分支.我如何结帐主人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆