Adding a Submodule to a Git Repository
Adding a submodule to your git repository is actually quite simple. For example, if you are in the working directory of the repository, to add a new submodule:
$ git submodule add <git url>
-
git submodule add
– This simply tells Git that we are adding a submodule. This syntax will always remain the same. -
<git url>
– This is the external repository that is to be added as a submodule.
If you want to more control over add
feature:
$ git submodule add -b <branch> <git url> <folder/subfolder>
-
<branch>
– This fetching different branch from yourdefault
branch, e.gmaster
-
<folder/subfolder>
– This add your submodule to another subfolder
to activate
the submodule:
$ git submodule init
Top comments (0)