List submodules in a Git repository

You could use the same mechanism as git submodule init uses itself, namely, look at .gitmodules. This files enumerates each submodule path and the URL it refers to. For example, from root of repository, cat .gitmodules will print contents to the screen (assuming you have cat). Because .gitmodule files have the Git configuration format, you … Read more

Git update submodules recursively

You will also probably want to use the –init option which will make it initialize any uninitialized submodules: Note: in some older versions of Git, if you use the –init option, already-initialized submodules may not be updated. In that case, you should also run the command without –init option.

How to “git clone” including submodules?

With version 2.13 of Git and later, –recurse-submodules can be used instead of –recursive: Editor’s note: -j8 is an optional performance optimization that became available in version 2.8, and fetches up to 8 submodules at a time in parallel — see man git-clone. With version 1.9 of Git up until version 2.12 (-j flag only available in version 2.8+): With version 1.6.5 … Read more

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 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:

How do I remove a submodule?

Since git1.8.3 (April 22d, 2013): There was no Porcelain way to say “I no longer am interested in this submodule”, once you express your interest in a submodule with “git submodule init“.“git submodule deinit” is the way to do so. The deletion process also uses git rm (since git1.8.5 October 2013).

Git submodule update

This GitPro page does summarize the consequence of a git submodule update nicely When you run git submodule update, it checks out the specific version of the project, but not within a branch. This is called having a detached head — it means the HEAD file points directly to a commit, not to a symbolic … Read more