Does git submodule add also support sparse checkout?

problem description

at present, git has supported the cloning of some codes as follows:

-sharp 
git remote add -f origin <remote_url>
-sharp  spare checkout
git config core.sparsecheckout true
-sharp 
echo "subdir1" >> .git/info/sparse-checkout
-sharp 
git pull origin  master 

this will only send / subdir1 Synchronize from the remote library locally.

now my question is: does git submodule add, also support sparse checkout?

looked up the help and didn"t seem to see anything about it.

desired effect

A typical scenario is that there is a python common library with multiple directories, such as

common-lib/          -sharp  git://reposity/common-lib.git 
    doc/             -sharp 
    src/             -sharp 
        common/      -sharp 
        test-common/ -sharp 

then a project yasi-project, that uses this library expects to have the following structure:

yasi-project/        -sharp yasi git://reposity/yasi-project.git 
    doc/             -sharp 
    src/             -sharp 
        common/      -sharp  -> common-lib/src/common
        yasi/        -sharp 
        test-yasi/   -sharp 

can git support the above structure?

Git
Mar.02,2022

after you add the subwarehouse with submodule , you will see the configuration of the subwarehouse under .git / modules/xxx

.

Open sparsecheckout
just add the sparse-checkout file, which is the same

Menu