Git submodules are a way of including another repository’s code into an existing codebase, without associating it’s code or tracking history in the parent repository.
Add a Git Submodule to an Existing Codebase
cd <parent_codebase_root>
git submodule add <remote_url> <destination_folder>
So let’s say that we have a project called project_website
, a repository at the following path https://github.com/user/repo.git
and a target folder we’d like the submodule added to at user_repo
, we could construct our query like this:
An Example of how to Add a Git Submodule
cd project_website
git submodule add https://github.com/user/repo.git user_repo