微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Git无法在android studio中看到远程分支

我只有git的基础知识.

我只使用命令行和以下命令从我的远程克隆单个分支(存储库在克隆时有多个分支)

git clone <url> --branch <branch> --single-branch

我可以使用我的android-studio IDE vcs对克隆分支的支持来完成所有git操作.现在我想切换我的远程分支,但我的android-studio IDE没有显示远程分支.它只显示我曾经克隆过的一个分支.从我的搜索,我检查了以下解决方案,但不起作用.

Refresh remote Git branches in Android studio

如何在不从头开始克隆主分支的情况下获取远程分支列表?

解决方法:

你只看到一个分支,因为你使用了–single-branch

git documentation

–[no-]single-branch

Clone only the history leading to the tip of a single branch, either specified by the –branch option or the primary branch remote’s HEAD points at. Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point at any branch when –single-branch clone was made, no remote-tracking branch is created.

要撤消这个:

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin

添加单个分支:

git remote set-branches --add origin [remote-branch]
git fetch origin [remote-branch]:[local-branch]

原文地址:https://www.jb51.cc/android/1075114.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐