Does git provide bare submodules?
It might be awful, I'm not sure.
Let's say we have a "product" repo with a working directory
/product
/product/command.script
/product/config/ (bare git repo)
And the "config" repo with the working directory
/config /config/config.json
The command.script file has actions for interacting with an open repo. ex. Running command.script BRANCH1 would have executed the command
git show BRANCH1:config.json
Is there a way that the "/ product / config /" folder can be a submodule of the "product" repo so that when the "product" clone is cloned the "config" repository will be cloned as well
git clone --bare [config origin here] config
by its origin and when the "commodity" repo is called, the submodule "/ product / config" can be selected
git fetch origin '*:*'
Or is it something to be handled with some kind of hooks?
source to share
No: when you select the "product" of the repo, its index will contain gitlink (a special entry that writes the SHA1 of the submodule) .
This entry can only be used in an irregular repo to be consumed as a nested (submodular) repo.
That's why the git clone
man page :
--recursive
--recurse-submodules
After creating a clone, initialize all submodules inside using their default settings. This is equivalent to launching
git submodule update --init --recursive
immediately after cloning is complete.
This parameter is ignored if the cloned repository does not have a worktree / checkout (i.e. if any of--no-checkout/-n
,--bare
or are specified--mirror
)
This means that it is best for the repo to config
be cloned separately (even bare) in the right SHA1 (the one written by gitlink in the first repo rep product
) and for the one git show BRANCH1:config.json
executed in that other cloned repo ( sgit -C
).
source to share