Ninetiger blog

-- my reminder

How to only clone subdirectories from a Git Repository

This is called sparse checkout, since version 1.7.0.

Steps:

  1. Create an empty repo.
  2. Turn on sparse checkout feature
  3. Edit .git/info/sparse-checkout file to only include the files or folders needed.

 

mkdir <repo>
cd <repo>
git init
git remote add -f origin <url>

 

git config core.sparseCheckout true

Then edit .git/info/sparse-checkout, eg:

 

some/dir/

 

some/dir/somefile.txt
Comments:
by dobsonz, 2020年10月18日 9:27:31 PM Iz4UoM http://pills2sale.com/ levitra nizagara
by dobsonz, 2020年10月18日 9:27:29 PM Iz4UoM http://pills2sale.com/ levitra nizagara

Back to top