How to git fetch efficiently from a shallow clone

前端 未结 5 630
长情又很酷
长情又很酷 2020-11-27 03:53

We use git to distribute an operating system and keep it upto date. We can\'t distribute the full repository since it\'s too large (>2GB), so we have been using shallow clon

5条回答
  •  無奈伤痛
    2020-11-27 04:31

    If you can select a specific branch, it can be even faster. Here's an example using Spark master branch and latest tag:

    Initial clone

    git clone git@github.com:apache/spark.git --branch master --single-branch --depth 1
    

    Update to specific tag

    git fetch --depth 1 origin tags/v1.6.0
    

    It becomes very fast to switch tags/branch this way.

提交回复
热议问题