-
To clone the repository with the gitsubmodules:
git clone --recursive <URL to Git repo>
-
To clone the GSM in (if you missed the previous command):
git submodule update --init --recursive
- To add a gitsubmodule to a current directory, run:
git submodule add -b <main> --name <name_of_GSM> <path_to_github_url> <path_to_submodule>
e.g:
$ git submodule add -b main --name cv_utils git@github.com:lackdaz/cv_utils.git lib_cv_utils
- Modify the
.gitmodules
files with a text editor:
vim .gitmodules
- Then run:
git submodule sync
to update the.git/config
files.
- Delete the relevant GSM from the
.gitmodules
file with a text editor:
vim .gitmodules
- Delete the relevant line from
.git/config
:vim .git/config
- Remove the git cache:
git rm --cached <path_to_submodule>
- Commit and delete the untrack GSM:
rm -rf <path_to_submodule>
git add . && commit -m <removed_x_submodule>