Git Commands for Cloning and Updating Repositories with Submodules
git clone --recurse-submodules <repository_url>
Purpose: Clones a Git repository and recursively initializes and updates all of its
submodules in a single step.
Explanation:
Submodules: Nested Git repositories within your main project.
Recursive Cloning: Automatically clones the main repository and then
recursively clones all submodules, including any nested submodules.
Convenience: Streamlines the initial setup of a project with submodules.
Example:
Bash
git clone --recurse-submodules [Link]
git pull --recurse-submodules
Purpose: Fetches and merges changes from the remote repository, including updating
any submodules to the commit referenced in the main repository.
Explanation:
Main Repository Update: Pulls the latest changes from the remote tracking
branch of your main repository.
Submodule Update (if needed): Fetches the latest commits from each
submodule's remote, but checks out the commit specified in your main
repository's index (not necessarily the latest).
Simplifies Workflow: Automates updating both the main repository and its
submodules.
Example:
Bash
git pull --recurse-submodules
git submodule update --init --recursive
Purpose: Initializes and updates all submodules in the repository to the commit
referenced in the main project, including nested submodules.
Explanation:
Initialization: Registers the submodules with your local Git repository if they
haven't been initialized before.
Recursive Update: Updates each submodule to the specific commit recorded in
your main project, including any nested submodules.
Use Case: Ideal if you've cloned a repository without --recurse-submodules or
new submodules were added later.
Example:
Bash
git submodule update --init --recursive
git submodule update --remote --merge
Purpose: Fetches and merges the latest changes from the remote tracking branch into
each submodule, allowing you to bring in the most recent updates from the submodules'
own repositories.
Explanation:
Fetch and Merge: Fetches the latest commits from each submodule's remote
repository and merges them into the current branch of each submodule.
Respect Custom Branches: If a submodule is on a branch other than the
default (e.g., not main), this command will update to the latest commit on that
specific branch.
Recommended for Active Development: Provides flexibility when submodules
are actively developed and you want to stay up-to-date.
Example:
Bash
git submodule update --remote --merge
To get a specific version for all submodules you should use these:
This Py file is running with CMD passing to it repo URL, clone directory path
(must include [Link] in your provided path and it must be empty), and max
retries for pulling the repo.
[Link]
This is an EXE for the same task above but you provide it a config file with the
attached structure in the same directory as the exe
[Link]
[Link]
[Link]