Is it possible to do a sparse checkout without checking out the whole repository first?

后端 未结 14 1646
醉梦人生
醉梦人生 2020-11-22 09:32

I\'m working with a repository with a very large number of files that takes hours to checkout. I\'m looking into the possibility of whether Git would work well with this kin

14条回答
  •  心在旅途
    2020-11-22 10:14

    In git 2.27, it looks like git sparse checkout has evolved. Solution in this answer does not work exactly the same way (compared to git 2.25)

    git clone  --no-checkout 
    cd 
    git sparse-checkout init --cone # to fetch only root files
    git sparse-checkout set apps/my_app libs/my_lib # etc, to list sub-folders to checkout
    # they are checked out immediately after this command, no need to run git pull
    

    These commands worked better:

    git clone --sparse  
    cd 
    git sparse-checkout init --cone # to fetch only root files
    git sparse-checkout add apps/my_app
    git sparse-checkout add libs/my_lib
    

    See also : git-clone --sparse and git-sparse-checkout add

提交回复
热议问题