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
.gitmodulesand to.git/configwithgit submodule add --name <submodule_name> <url> <path_to_subdir> - Move the submodule's
$GIT_DIRdirectory (.gitin regular repositories) to.git/modules/<path>withgit submodule absorbgitdirs <path_to_subdir>