Use case:
- there is a project directory with an initialized git repo inside
- there is a sub-directory with another initialized git repo inside
Goal:
add the subdirectory as a git submodule to the root project repo
Steps:
- Add the submodule's url to
.gitmodules
and to.git/config
withgit submodule add --name <submodule_name> <url> <path_to_subdir>
- Move the submodule's
$GIT_DIR
directory (.git
in regular repositories) to.git/modules/<path>
withgit submodule absorbgitdirs <path_to_subdir>