I'm trying to get a submodule list of a repo before preforming clone.
And then to choose which submodule repo to clone.
Is there any way to do it?
I'm trying to get a submodule list of a repo before preforming clone.
And then to choose which submodule repo to clone.
Is there any way to do it?
If you want to review the list of submodules of the first level without cloning the superproject download file .gitmodules
from the superproject. You can use git archive
:
git archive --format=tar --remote=$ORIGIN_URL HEAD -- .gitmodules | tar -O -xf -
As submodules could be recursive you have to repeat this for every submodule found in the downloaded .gitmodules
.
After that you can clone any submodule's repository manually.
You may also want to review the list of submodules after cloning the superproject. First, clone without submodules:
git clone $ORIGIN_URL # Don't use `--recursive`
cd <repo_dir>
git submodule init
cat .gitmodules
git submodule update submodule1 submodule2…