How to add a Git Submodule to an existing codebase

0 min read 92 words

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
Tags:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags