What is a submodule?
Usually when you are working on a project, you may need to use another library or project as a component inside it. It is ideal that you are able to treat the two project separate, yet still maintain accessibility from one or another.
For example, you've written a library to read big JSON files effectively and want to include it into your newly-built data processing program. One option is copying all of its source code into the new project, which can pose problems when the original code changes. Another solution is loading it from a shared library on the internet, which only suitable for public projects.
A Git submodule allows you to keep a Git repository as a subdirectory of another Git repository. Thanks to submodules, you can clone any repository into your own project while still maintain separate commits.
Git submodule tutorials
- Clone a git repository and add as submodule
- .gitmodules file
- Update or pull the latest content to a submodule
- Delete a git submodule