- Clone a repo tree
git clone --recurse-submodules remote_url - Link a submodule
git submodule add submodule_remote_url local_linking_path
# Then commit & push to the main repo - Pull from a submodule
# Pull from specific branch
git pull --recurse-submodules my-branch
# Then commit & push to the main repo
- Update a submodule
cd submodule_path
# Do the commits and push normally, the changes will be pushed to submodule repo
cd main
# Then do a commit and push to the main module
- Reset submodule head to currently stored reference
git submodule update --init 