当分支未在git branch -l中显示时更改分支 [英] change the branch when the branch not shown in git branch -l

查看:80
本文介绍了当分支未在git branch -l中显示时更改分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我克隆远程存储库时,我使用了以下命令-

When I cloned a remote repository, I used the following command-

git clone -b mybranch --single-branch git://sub.domain.com/repo.git

在那之后,当我执行git branch -l时,它只是向我显示了我克隆的分支.现在,我想拉另一个分支,但这并没有显示其他分支.我该怎么办?

After that, when I did a git branch -l it just showed me the branch I cloned. Now, I want a pull of another branch, but it is not showing me other branches. What should I do?

推荐答案

您可以使用git ls-remote命令直接在遥控器上列出分支:

You can list the branches directly on the remote with git ls-remote command:

git ls-remote git://sub.domain.com/repo.git

然后使用git fetch命令来获取特定分支,并使用git checkout命令来切换到该分支.

Then use git fetch command to fetch a specific branch and git checkout command to switch to the branch.

这篇关于当分支未在git branch -l中显示时更改分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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