To populate a repository's submodules, one typically invokes:
git submodule init
git submodule update
In this usage, git submodule init
seems to do only one thing: populate .git/config
with information that is already in .gitmodules
.
What is the point of that?
Couldn't git submodule update
simply use the information from .gitmodules
? This would avoid both:
git submodule init
); and.gitmodules
content into .git/config
).Either:
git submodule init
that I do not know (in which case, please enlighten me!); or elsegit submodule init
is cruft that could be deprecated in Git without any harm.Which of these is true?
Reading the git submodule
documentation, there is a use-case that ostensibly justifies the existence of git submodule init
as a standalone command.
If a user who has cloned a repository wishes to use a different URL for a submodule than is specified by the upstream repository, then that user can:
git submodule init
vim .git/config # Alter submodule URL as desired, without changing .gitmodules
# or polluting history.
git submodule update