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

后端 未结 14 1636
醉梦人生
醉梦人生 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:07

    Sadly none of the above worked for me so I spent very long time trying different combination of sparse-checkout file.

    In my case I wanted to skip folders with IntelliJ IDEA configs.

    Here is what I did:


    Run git clone https://github.com/myaccount/myrepo.git --no-checkout

    Run git config core.sparsecheckout true

    Created .git\info\sparse-checkout with following content

    !.idea/*
    !.idea_modules/*
    /*
    

    Run 'git checkout --' to get all files.


    Critical thing to make it work was to add /* after folder's name.

    I have git 1.9

提交回复
热议问题