-
Notifications
You must be signed in to change notification settings - Fork 2
Update git submodules
To pull Git submodules, you typically follow a two-step process: initializing the submodule and then fetching the submodule's data. Here's how you can do it:
-
Initialize the Submodules: If you've just cloned a repository with submodules, you first need to initialize them. You can do this with:
git submodule init
This command initializes your local configuration file and prepares the submodules to be fetched.
-
Update the Submodules: After initialization, you need to fetch the data from the submodule repositories and check out the appropriate commit. You can do this with:
git submodule update
This command fetches all the data from the submodule projects and checks out the commits specified in the superproject.
If you want to both initialize and update your submodules in one command, especially after cloning a repository, you can use:
git submodule update --init
If the submodules have submodules themselves (nested submodules), you can initialize and update all of them recursively using:
git submodule update --init --recursive
If you want to update your submodules to the latest commit available in their respective remote repositories, you can use:
git submodule update --remote
This command will fetch the latest changes in the submodules' remote branches and update your submodules to point to those latest commits.