Create a new directory /databases, copy the Git history of remote
git read-tree —prefix=[directory_name]/ -u [directory_name]/master
git read-tree —prefix=databases/ -u databases/master
Commit the subtree merge
git commit -m “Subtree merged in /databases.”
Clone a repository with a submodule git clone --recursive [URL to Git Repo]
Pull new updates into the submodule
cd [submodule directory]git checkout mastergit pullcd ..git add [submodule directory]git commit -m "Move submodule to the latest commit in master."git push
Pull new updates into the main repository including changes in its submodules (not working quite) git pull --recurse-submodules
Pull all changes for the submodules (alternative for #3)
git submodule update --remote
if you pull in new changes into the submodules, you need to create a new commit in your main repository in order to track the updates of the nested submodules.
Execute git commands on every submodule. i.e., (reset all submodules) git submodule foreach --recursive 'git reset --hard'