This repository is a monorepo that contains all my active projects as submodules, effectively bridging a manyrepo and monorepo. This allows me to keep all my projects in one place and easily manage them in VSCode, while avoiding common pitfalls introduced with monorepos (e.g. no repo-per-product, complex release-strategy, overpriviliged access)
When you clone the monorepo for the first time, you need to initialize the submodules:
git submodule update --init --recursiveAlternatively, you can clone the monorepo with the --recurse-submodules flag:
git clone --recurse-submodules git@github.com:devantler-tech/monorepo.gitMake sure that all submodules are checked out on the correct branch the first time you clone the monorepo. Otherwise, you might risk loosing changes as the submodule will be in a detached head state.
Note
Submodules are configured to clone with SSH, so it requires adding your public SSH key to GitHub. You will not be able to clone the submodules with HTTPS. This decision was made, as HTTPS will require authentication on every request, where as SSH can do this automatically when the public key is shared.
git submodule add -b <branch> <ssh-url> <path>There are three scenarios for updating a submodule:
- You want to update the submodule to the latest commit on the branch it is tracking.
- You want to update a submodule's upstream url.
- You want to rename/move a submodule.
All submodules are configured to automatically update to the latest commit on the branch they are tracking.
To update a submodule's upstream url, you need to run the following command:
git submodule set-url -- <path> <newurl>To rename or move a submodule, you need to run the following command:
git mv old/path/to/submodule new/path/to/submodule./delete-submodule.sh <path>