Skip to content

Instantly share code, notes, and snippets.

@viniciusvts
Last active July 3, 2023 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viniciusvts/02202e8fc80decb27a0af5ab7b96f080 to your computer and use it in GitHub Desktop.
Save viniciusvts/02202e8fc80decb27a0af5ab7b96f080 to your computer and use it in GitHub Desktop.

Add submodule to project

It add the submodule:

git submodule add -b <branch> <repository_url> <diretory_path>

Clone projects with submodules:

Cloning a project who has submodules, use the clone command with the option --recurse-submodules. It will garantee submodules are also cloned.

git clone --recurse-submodules <repository_url>

If you already cloned and forgot the option, you can update submodules using the command:

git submodule update --init --recursive

Update submodules

Use git submodule update to update them later. Add --recursive to all nested submodules (submodules inside other submodules) are also updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment