Git clone individual files in a warehouse [Record]

Note: This method will download the entire project, however, it appears that the last file in the local project file, only the desired folder exists. Similarly to download, and then filtered.

Sometimes we just want to because of the need gitclone under a single warehouse or multiple folders, but not all of the contents of the warehouse, so it is easy, here to do a record.

for example

There is now a test warehouse https://github.com/mygithub/test
you need git clone inside tt subdirectory:

. 1 Git the init && Test Test CD      // create a new folder and into the warehouse 
2 Git config core.sparsecheckout to true  // set to allow cloning of subdirectories 
. 3  
. 4  echo  ' TT * ' >> .git / info / sparse-Checkout // Sets subdirectory path warehouses clones (tt * change your file directory)    // spaces do not forget 
5  
6 git the Add Remote [email protected] Origin: mygithub / test.git   // into this project and you want to clone library 
7  
8 git pull Origin Master     // Download

 

Guess you like

Origin www.cnblogs.com/cpl9412290130/p/11441893.html