Muh*_*s M 4 git android github android-studio
我只有 git 的基本知识。
我只使用命令行和以下命令从远程克隆了单个分支(克隆时存储库有多个分支)
git clone <url> --branch <branch> --single-branch
Run Code Online (Sandbox Code Playgroud)
我能够使用我的 android-studio IDE vcs 支持对克隆分支执行所有 git 操作。现在我想切换我的远程分支,但我的 android-studio IDE 没有显示远程分支。它只显示了我用来克隆的一个分支。从我进行的搜索中,我检查了以下解决方案但不起作用。
如何在不从头开始克隆主分支的情况下获取远程分支列表?
You are only seeing one branch, because you used --single-branch
From the 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
Run Code Online (Sandbox Code Playgroud)
添加单个分支:
git remote set-branches --add origin [remote-branch]
git fetch origin [remote-branch]:[local-branch]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2477 次 |
| 最近记录: |