Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git submodule "--reference" parameter

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?

like image 749
MuertoExcobito Avatar asked Oct 29 '22 09:10

MuertoExcobito


1 Answers

"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 --dissociate option to add/update commands

Add --dissociate option to add and update commands, both clone helper commands that already have the --reference option --dissociate pairs with.

The documentation now adds:

--dissociate::

This option is only valid for add and update commands.
These commands sometimes need to clone a remote repository. In this case, this option will be passed to the git clone command.

like image 119
VonC Avatar answered Nov 13 '22 22:11

VonC