What is the point of 'git submodule init'?

Background

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.

  • How to securely save git credentials?
  • git version control files on repositories without pushing/pulling
  • Add patch in git, all hunks matching regex in file
  • build trigger based on checkins to specific folder in a GIT repo in teamcity
  • How to use Hg-to-Git tool - fast-export?
  • Eclipse Egit will not import repo in workspace
  • 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).

    Question

    Either:

    • 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?

  • Git in Android Studio disappeared?
  • How to provide username and password when run “git clone git@remote.git”?
  • How to add a orphan branch in smartgit
  • How to merge individual commits from another branch without side effects (aka without using cherry-pick)?
  • PHPStorm, Vendor and multiple Git roots
  • How to update file write permission in Git
  • 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.