qtechdev.github.io

View on GitHub

submodules

git submodule allows for a nested git repository.

A reference to the module repo (module_greeter) is placed inside the main repo (testing_modules) at a given path (modules/greeter).

Cloning the repo via git clone will not clone the submodule also. The --recursive flag must also be specified. Submodules can be cloned mannually via git submodule init and git submodule update.

A submodule is included at a specific commit. Submodules can be updated with git submodule update or via git pull --recurse-submodules, however their HEAD will remain on the same commit.
To change the commit pointed to, the user must:

pros

cons

final word

I don’t think submodules are the best approach at the moment, but I may reconsider in the future.