See documentation Git - Submodules, basic usage below.
The default git clone …
is not enough, so:
git clone --recurse-submodules TARGET_REPO
…or
git clone TARGET_REPO
git submodule init
git submodule update
git status
git submodules status
git pull --recurse-submodules
…you can make it default
git config submodule.recurse true
Or:
git submodule foreach git pull
cd TARGET_PATH
git submodule add -b main --depth=1 TARGET_REPO
git submodule deinit -f TARGET_PATH
rm -rf .git/modules/TARGET_PATH
git rm -rf TARGET_PATH
… TARGET_PATH
can be found via ##Status, source: Remove A Submodule In Git | Rm -rf - Javaexercise.
… define alias in your .gitconfig
:
rm-submodule = !git submodule deinit -f $1 && rm -rf .git/modules/$1 && git rm -rf $1