Home Explore Blog CI



git

4th chunk of `Documentation/git-submodule.adoc`
a15863000d4f02eee138b2fc09723cbf3de55c0f1036e6f20000000100000fa1
 `--ref-format <format>`  is specified, the ref storage format of newly
cloned submodules will be set accordingly.

If `--filter <filter-spec>` is specified, the given partial clone filter will be
applied to the submodule. See linkgit:git-rev-list[1] for details on filter
specifications.
--
set-branch (-b|--branch) <branch> [--] <path>::
set-branch (-d|--default) [--] <path>::
	Sets the default remote tracking branch for the submodule. The
	`--branch` option allows the remote branch to be specified. The
	`--default` option removes the submodule.<name>.branch configuration
	key, which causes the tracking branch to default to the remote 'HEAD'.

set-url [--] <path> <newurl>::
	Sets the URL of the specified submodule to <newurl>. Then, it will
	automatically synchronize the submodule's new remote URL
	configuration.

summary [--cached|--files] [(-n|--summary-limit) <n>] [commit] [--] [<path>...]::
	Show commit summary between the given commit (defaults to HEAD) and
	working tree/index. For a submodule in question, a series of commits
	in the submodule between the given super project commit and the
	index or working tree (switched by `--cached`) are shown. If the option
	`--files` is given, show the series of commits in the submodule between
	the index of the super project and the working tree of the submodule
	(this option doesn't allow to use the `--cached` option or to provide an
	explicit commit).
+
Using the `--submodule=log` option with linkgit:git-diff[1] will provide that
information too.

foreach [--recursive] <command>::
	Evaluates an arbitrary shell command in each checked out submodule.
	The command has access to the variables $name, $sm_path, $displaypath,
	$sha1 and $toplevel:
	$name is the name of the relevant submodule section in `.gitmodules`,
	$sm_path is the path of the submodule as recorded in the immediate
	superproject, $displaypath contains the relative path from the
	current working directory to the submodules root directory,
	$sha1 is the commit as recorded in the immediate
	superproject, and $toplevel is the absolute path to the top-level
	of the immediate superproject.
	Note that to avoid conflicts with '$PATH' on Windows, the '$path'
	variable is now a deprecated synonym of '$sm_path' variable.
	Any submodules defined in the superproject but not checked out are
	ignored by this command. Unless given `--quiet`, foreach prints the name
	of each submodule before evaluating the command.
	If `--recursive` is given, submodules are traversed recursively (i.e.
	the given shell command is evaluated in nested submodules as well).
	A non-zero return from the command in any submodule causes
	the processing to terminate. This can be overridden by adding '|| :'
	to the end of the command.
+
As an example, the command below will show the path and currently
checked out commit for each submodule:
+
--------------
git submodule foreach 'echo $sm_path `git rev-parse HEAD`'
--------------

sync [--recursive] [--] [<path>...]::
	Synchronizes submodules' remote URL configuration setting
	to the value specified in `.gitmodules`. It will only affect those
	submodules which already have a URL entry in .git/config (that is the
	case when they are initialized or freshly added). This is useful when
	submodule URLs change upstream and you need to update your local
	repositories accordingly.
+
`git submodule sync` synchronizes all submodules while
`git submodule sync -- A` synchronizes submodule "A" only.
+
If `--recursive` is specified, this command will recurse into the
registered submodules, and sync any nested submodules within.

absorbgitdirs::
	If a git directory of a submodule is inside the submodule,
	move the git directory of the submodule into its superproject's
	`$GIT_DIR/modules` path and then connect the git directory and
	its working directory by setting the `core.worktree` and adding
	a .git file pointing to the git directory embedded in the
	superprojects git directory.
+
A repository that was cloned independently and

Title: Git Submodule Management Commands
Summary
The provided text describes various Git submodule management commands, including set-branch, set-url, summary, foreach, and sync. These commands allow for setting default remote tracking branches, updating submodule URLs, showing commit summaries, evaluating shell commands in submodules, and synchronizing submodule configurations. The text also explains the absorbgitdirs command, which moves a submodule's Git directory into its superproject's modules path and connects the Git directory to its working directory.