#git
Here's a quick primer on how to work with Git submodules!
git submodule add repo_url [directory]
git commit -m 'added xyz as a dependency'
git submodule add
works like git clone
, so the directory name can be ommited. The changes will automatically be added to the index, so you can commit them right away!
git clone repo_url --recursive
This will first clone the repo, and then initialize and update (read on) all submodules.
If you forget the --recursive
flag when cloning, or when pulling in commits that add a Submodule, you have to do two steps: initialize, update:
git submodule init
git submodule update
This will create the required directories and then pull in the other repos.
Easy:
git submodule update --remote
git add submodule_dir
git commit ...
That’s it!
For more in-depth information on Git Submodules, read the official documentation
Next post: "Managing DNS records the DevOps way"
Previous post: "Java: Create self-signed TLS/SSL certificates for Tomcat"
List all Blog posts