gitgithubrepositorysparse-checkoutshallow-clone

Sparse checkout and shallow clone


When I tried to add library to CDN it's says I need to sparse checkout and shallow clone to make PR easily. So what's those? I read some articles but didn't understand well.


Solution

  • The cndjs doc points to documents/sparseCheckout.md

    It involves:

    git config core.sparseCheckout true
    # edit .git/info/sparse-checkout
    # and 
    git pull origin master --depth 10
    

    That allows you to limit the data you need to work on that huge repo:

    Currently, cdnjs's repo is too huge and some people have issues with using it when it is this big.
    To get around the issue or repo size you can use sparse-checkout. It lets you check out only the files you want, so that the whole directory in your computer won't need to be 11GB, but only about 1GB (you can make this even smaller with shallow pull too!)


    Update January 2020, 4 years later:

    You would need to use the Git 2.25 git sparse-checkout command.