问题描述
克隆远程仓库后,它不会通过-a选项显示任何远程分支。可能是什么问题呢?如何调试它?在这段代码中没有显示两个远程分支:$ $ $ git clone --depth 1 git://git.savannah .gnu.org / pythonwebkit.git
$ cd pythonwebkit
$ git branch -a
* master
remotes / origin / HEAD - >原产地/主产地
遥控器/产地/主产地
$ git --version
git版本1.8.3.1
在另一台机器上尝试了相同的命令,它运行良好:
$ git clone - 深度1 git://git.savannah.gnu.org/pythonwebkit.git
接收对象:100%(186886/186886),818.91 MiB | 3.44 MiB / s,完成。
$ cd pythonwebkit /
$ git branch -a
* master
remotes / origin / HEAD - >起源/大师
遥控器/原产地/ debian
遥控器/原产地/主控制器
遥控器/原产地/ python_codegen
$ git --version
git版本1.7.1
试过也克隆另一个回购,它效果很好。虽然我可以在这台机器上再次尝试它,但最好知道错在哪里。
任何建议或提示都会受到欢迎。
编辑:回答总结:由于git版本1.8.3.2需要一起使用--depth和--no-single-branch与以前一样的行为。这被认为是一个错误修复。
行为是正确的,在最后一次修订后,master-branch是唯一的(因为这是主要远程的HEAD)远程分支:
florianb $ git分支-a
* master
遥控器/原点/ HEAD - >原产地/主产地
遥控器/产地/主产地
:
florianb $ git branch -a
* master
remotes / origin / HEAD - >起源/大师
遥控器/原产地/ debian
遥控器/原产地/母版
遥控器/原产地/ python_codegen
浅克隆
由于为 - -single-branch
-option描述:
因此,浅克隆 (深度选项)仅获取 一个分支(在您的请求中 不幸的是,两个选项( After cloning a remote repository it does not show any remote branch by -a option. What could be the problem? How to debug it? In this snippet two of the remote branches are not shown: Tried the same command on another machine, it works well: Tried also cloning another repo, it works well. Though I can try it on this machine again, but it would be better to know what's wrong. Any suggestions or hints will be more than welcome. Edit: Answer summary: Since git version 1.8.3.2 the "--depth" and "--no-single-branch" need to be used together to get the same behavior as before. This is deemed a bug fix. The behavior is correct, after the last revision the master-branch is (since this is the primary remote's HEAD) the only remote-branch in the repository: The full clone offers new (all) branches: Due to the shallow-description in the technical documentation, a " As - in addition - the documentation of Therefore a shallow clone (with the depth-option) only fetches only one single branch (at your requested depth). Unfortunately both options ( 这篇关于git浅克隆(克隆 - 深度)遗漏远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
- depth
和 - 单分支
)过去一直存在问题,使用浅层克隆会引发未解决的问题(正如您可以在上面发布的链接中看到的那样),这是由给定的历史改写引起的。这在特殊情况下总体上会导致一些复杂的行为。$ git clone --depth 1 git://git.savannah.gnu.org/pythonwebkit.git
$ cd pythonwebkit
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
$ git --version
git version 1.8.3.1
$ git clone --depth 1 git://git.savannah.gnu.org/pythonwebkit.git
Receiving objects: 100% (186886/186886), 818.91 MiB | 3.44 MiB/s, done.
$ cd pythonwebkit/
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/debian
remotes/origin/master
remotes/origin/python_codegen
$ git --version
git version 1.7.1
florianb$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
florianb$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/debian
remotes/origin/master
remotes/origin/python_codegen
Shallow clones
git-clone --depth 20 repo
[...] result[s in] commit chains with a length of at most 20." A shallow clone therefore should contain the requested depth of commits, from the tip of a branch.git clone
for the --single-branch
-option describes:--depth
and --single-branch
) have been faulty in the past and the use of shallow clones implicits unresolved problems (as you can read in the link I posted above), which is caused by the given history-rewrite. This leads in overall to somewhat complicated behavior in special cases.