I have a git project that I'd like to clone and update submodules on. I clone the project with
git clone --single-branch -b my_branch ssh://my_repo my_repo
I can init and pull submodules with
git submodule init
git submodule update
The problem I'm having is that all repository's git history (~ 1.3Gb) is being pulled with the update on each submodule. My .gitmodules
file looks like
[submodule "mod_1"]
path = path/to/mod_1
url = my_repo
branch = mod_1_branch
[submodule "mod_2"]
path = path/to/mod_2
url = my_repo
branch = mod_2_branch
In the git clone
command above I use --single-branch
option which resolves the problem for the whole repository. As far as I know this option is not available for git submodule update
.
How can I restrict submodules to pull only their branch history? Could there be an appropriate custom command (as described here under update
> custom command
)?