Submodules are a way of including third-party git repos in a project. For example, the TCPDF library might be included as a submodule in the repo of a WordPress theme.
Adding a Submodule
Add an existing git repository as a submodule:
The submodule is added by default to a directory with the same name as the repo - in this case “CMB2”.
Clone With Submodules
To clone a project with submodules, use the
Retrospectively Add Submodules
You can also clone submodules as a second step - this may be necessary if you have already cloned the repo:
You can create and switch to a new branch, which allows you to work without affecting the production code. Once happy wit changes, the branch can be merged back and deployed.
If you’re using this to deploy code onto a remote server, remember that you may need an SSH key pair connection to the remote repo (e.g. GitHub).
comments powered by Disqus