How do I clone a single branch in Git?

后端 未结 21 2530
再見小時候
再見小時候 2020-11-22 00:09

I have a local Git repository called \'skeleton\' that I use for storing project skeletons. It has a few branches, for different kinds of projects:

casey@aga         


        
21条回答
  •  -上瘾入骨i
    2020-11-22 00:48

    If you want a shallow clone, you can do this with:

    git clone -b mybranch --depth=1 https://example.com/myproject.git localname
    

    --depth=1 implies --single-branch.

提交回复
热议问题