git clone, ignoring a directory

后端 未结 4 1626
名媛妹妹
名媛妹妹 2020-11-30 03:31

I\'m trying to test something on a wordpress install. In doing so, I\'d like to quickly replicate the repo. However, the upload directory (wp-content/uploads) i

4条回答
  •  死守一世寂寞
    2020-11-30 04:15

    A bit late to the party, but: Don't you want a sparse checkout?

    mkdir  && cd 
    git init
    git remote add –f  
    

    Enable sparse-checkout:

    git config core.sparsecheckout true
    

    Configure sparse-checkout by listing your desired sub-trees in .git/info/sparse-checkout:

    echo some/dir/ >> .git/info/sparse-checkout
    echo another/sub/tree >> .git/info/sparse-checkout
    

    Checkout from the remote:

    git pull  
    

    See http://jasonkarns.com/blog/subdirectory-checkouts-with-git-sparse-checkout/ for more info.

提交回复
热议问题