git submodule

If you’re working with a large project, then you must have come across the concept of Git Submodules.

In simple terms, Git submodule is a project packaged within an existing project.

In this article, we will explain how we can add a Git submodule to the main repository from your local machine.

But before we start, we’ll need to setup SSH in our machine. Here’s a link for your help https://cloudservicestutorial.com/connecting-to-github-with-ssh/.

In order to add a Git submodule:

First, go to the main repository in your system. There, you’ll find a folder named “app_src“. Open “git bash” in the target directory.

Use this command: $ git submodule add <your_sub_project_name>

Next, Open GitHub desktop and “commit” and then “push” the changes.

Now, you’ll be able to see a folder with the name of your submodule under /app_src, and a file named “.gitsubmodules” is created in your Git main repository. This file will contain the list of repositories that are packaged under your main module.

One thought on “How To Add GIT Submodule?”

Leave a Reply

Your email address will not be published. Required fields are marked *