In the git submodule documentation for git submodule add, it shows that there is a --reference parameter. Presumably, this works the same way the --reference parameter for git clone works, by copying objects from it, instead of the remote repository. After executing with this parameter, if I look inside .git/modules/<submodule>/objects/info, there is an alternates file, containing the path to the reference repo.
However, git clone also has a --dissociate parameter, to essentially do this for only the initial clone. Is there a way to the same thing for a submodule repository?
"git submodule update" and "git submodule add" supported the "--reference" option to borrow objects from a neighbouring local repository like "git clone" does, but lacked the more recent invention "--dissociate".
That is no longer the case with Git 2.18 (Q2 2018)
submodule: add
--dissociateoption to add/update commandsAdd
--dissociateoption to add and update commands, both clone helper commands that already have the--referenceoption--dissociatepairs with.
The documentation now adds:
--dissociate::This option is only valid for
addandupdatecommands.
These commands sometimes need to clone a remote repository. In this case, this option will be passed to thegit clonecommand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With