git shallow clone (clone --depth) misses remote branches

前端 未结 3 1023
误落风尘
误落风尘 2020-11-28 01:42

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

3条回答
  •  长情又很酷
    2020-11-28 02:18

    From reading the responses and the comment from @jthill, the thing that worked best for me was to use the set-branches option on the git remote command:

    $ git clone --depth 1 https://github.com/dogescript/dogescript.git
    $ git remote set-branches origin 'remote_branch_name'
    $ git fetch --depth 1 origin remote_branch_name
    $ git checkout remote_branch_name
    

    This changes the list of branches tracked by the named remote so that we can fetch and checkout just the required branch.

提交回复
热议问题