我只有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
–[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]