What is the point of 'git submodule init'?


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.

  • github not showing last 9 commits
  • List last edits of all file by a collection of users
  • Change date of git tag (or GitHub Release based on it)
  • Remove commits which aren't in subtree nor in original repository
  • Migrate a repo not always using the trunk/branches/tags structure from SVN to GIT
  • Hudson git clone error
  • What is the point of that?

    Couldn’t git submodule update simply use the information from .gitmodules? This would avoid both:

    • an unnecessary command (git submodule init); and
    • an unnecessary duplication of data (.gitmodules content into .git/config).



    • there are use-cases for git submodule init that I do not know (in which case, please enlighten me!); or else
    • git submodule init is cruft that could be deprecated in Git without any harm.

    Which of these is true?

  • Composer: Multiple Packages in one Repo
  • How to allow per user protected branches access in GitLab?
  • Yellow Indicator on Git Repository under Xcode 4
  • Why I cannot push my code to github?
  • Script to install and compile Python, Django, Virtualenv, Mercurial, Git, LessCSS, etc… on Dreamhost
  • Are there any downsides to enabling git rerere?
  • One Solution collect form web for “What is the point of 'git submodule init'?”

    Reading the git submodule documentation, there is a use-case that ostensibly justifies the existence of git 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
    Git Baby is a git and github fan, let's start git clone.