How does the submodule update command work in Git?
If you commit in your main repository, the state of the submodule is also defined by this commit. The git submodule update command sets the Git repository of the submodule to that particular commit. The submodule repository tracks its own content which is nested into the main repository.
How are Git repositories used to track changes?
Using Git repositories inside other Git repositories. Git allows you to include other Git repositories called submodules into a repository. This allows you to track changes in several repositories via a central one. Submodules are Git repositories nested inside a parent Git repository at a specific path in the parent repository’s working directory.
How to clone a git repository with submodules?
Cloning a repository that contains submodules. If you want to clone a repository including its submodules you can use the –recursive parameter. git clone –recursive [URL to Git repo] If you already have cloned a repository and now want to load it’s submodules you have to use submodule update.
Thus far I’ve just been rm -ing the module and re-adding it, but this is both wrong in principle and tedious in practice. The git submodule update command actually tells Git that you want your submodules to each check out the commit already specified in the index of the superproject.
Is the submodule really an independent repository?
The submodule is really an independent repository – just creating a new commit in the submodule and pushing that isn’t enough. You also need to explicitly add the new version of the submodule in the main project.
When to use submodule helper to stop parseopt?
When calling submodule helper, adding ” — ” in front of ” git pull ” will stop parseopt for parsing options that do not really belong to submodule–helper foreach. PARSE_OPT_KEEP_UNKNOWN is removed as a safety measure. parseopt should never see unknown options or something has gone wrong.