Skip to main content

8.3.2 Submodule Transient

o     (magit-submodule)

This transient prefix command binds the following suffix commands along with the appropriate infix arguments and displays them in a temporary buffer until a suffix is invoked.

Some of the below commands default to act on the modules that are selected using the region. For brevity their description talk about "the selected modules", but if no modules are selected, then they act on the current module instead, or if point isn’t on a module, then the read a single module to act on. With a prefix argument these commands ignore the selection and the current module and instead act on all suitable modules.

o a     (magit-submodule-add)

This commands adds the repository at URL as a module. Optional PATH is the path to the module relative to the root of the super-project. If it is nil then the path is determined based on URL.

o r     (magit-submodule-register)

This command registers the selected modules by copying their urls from ".gitmodules" to "$GIT_DIR/config". These values can then be edited before running magit-submodule-populate. If you don’t need to edit any urls, then use the latter directly.

o p     (magit-submodule-populate)

This command creates the working directory or directories of the selected modules, checking out the recorded commits.

o u     (magit-submodule-update)

This command updates the selected modules checking out the recorded commits.

o s     (magit-submodule-synchronize)

This command synchronizes the urls of the selected modules, copying the values from ".gitmodules" to the ".git/config" of the super-project as well those of the modules.

o d     (magit-submodule-unpopulate)

This command removes the working directory of the selected modules.

o l     (magit-list-submodules)

This command displays a list of the current repository’s modules.

o f     (magit-fetch-modules)

This command fetches all modules.

Option magit-fetch-modules-jobs controls how many submodules are being fetched in parallel. Also fetch the super-repository, because git fetch does not support not doing that. With a prefix argument fetch all remotes.