git submodule

Table of Contents

git submodule reference

# This will add .gitmodules to the repo
git submodule add

.gitmodules file will be created as follows:

[submodule "notes"]
  path = notes
  url =

When cloning this repository, there will only be empty directory for the submodule.

git submodule init           # From '.gitmodule' to '.git/config'
git submodule update         # Actual fetching

You can also do the same thing with one-liner:

git submodule update --init  # updates without explicit --init
Just simply do as follows:

To remove a submodule from the project, following steps required:

# Delete target module's entry in '.gitmodule'
# Delete target module's entry in '.git/config'
git rm --cached <submodule-path>