Skip to content

Shenanigans with submodules

Saul Pwanson edited this page Jul 29, 2017 · 3 revisions

Adding a submodule (creates a submodule config file):

git submodule add repository-url

When you clone a project with a subdirectory (initialise the submodule config file and fetches all of the data associated with the project):

git submodule update --init --recursive

Removing a submodule:

  1. Delete the line referring to the submodule in the .gitmodules file.
  2. Delete the section referring to the submodule from .git/config.
  3. git rm -cached module_path
  4. Commit
  5. rm -rf module_path