git submodule command

Git submodules allow us to keep a Git repository as a subdirectory of another Git repository. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules enable a Git repository to incorporate and track version history of external code.

Let’s start by adding an existing Git repository as a submodule of the repository that we’re working on. To add a new submodule, we use the following git syntax.

Syntax git submodule add <Path-to-repo>

The path can be absolute or relative URL of the project we would like to start tracking.