I have a submodule to be used with sparse checkout. Without sparse checkout I'd do
git submodule update --init <path/to/submodule>
but how to initialize the submodule repository empty without fetching it (or fetching it, but not checking it out) yet, so I can invoke
cd <path/to/submodule>
git config core.sparseCheckout true
cd <../../..>
echo <subdir-to-get> .git/modules/<path/to/submodule>/info/sparse-checkout
Unfortunately
git submodule init <path/to/submodule>
does not create the repository in .git/modules/<path/to/submodule>
and the file <path/to/submodule>/.git
.