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
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:
florianb$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
The full clone offers new (all) branches:
florianb$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/debian
remotes/origin/master
remotes/origin/python_codegen
Due to the shallow-description in the technical documentation, a "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.
As - in addition - the documentation of git clone for the --single-branch-option describes:
"Clone only the history leading to the tip of a single branch, either specified by the
--branchoption or the primary branch remote'sHEADpoints at. When creating a shallow clone with the--depthoption, this is the default, unless--no-single-branchis given to fetch the histories near the tips of all branches."
Therefore a shallow clone (with the depth-option) only fetches only one single branch (at your requested depth).
Unfortunately both options (--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.