Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Update git submodules

Joone Hur edited this page Apr 2, 2024 · 1 revision

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:

  1. 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.

  2. 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.

Clone this wiki locally