FahamLah

Commands

git submodule (add

git submodule (add <url> <path> | update --init [--recursive] | status)

Risk: Careful

What it does

Keeps another repo inside yours, linked at one exact commit.

When to use it

When you share code with other projects and want each to pick its version.

Example

$ git submodule add https://github.com/you/kuih-menu.git menu

Link the kuih-menu repo into a folder called menu.

$ git submodule update --init --recursive

Fill in empty submodule folders after a plain clone.

$ git clone --recurse-submodules https://github.com/you/shop.git

Clone a repo and its submodules in one go.