How do I make a new submodule in a remote Git repo?

172 Views Asked by At

I'm working on an open source project, "Project", which has two submodules, "Submodule1" and "Submodule2", with URLs "github.com/Project/Submodule1" and "github.com/Project/Submodule2".

I want to create a new submodule, "Submodule3". I've created it on my local machine, but I don't know how to get it into the remote repo on Github.

Does anyone know how to do this?

Clarification:

Submodule3 will be a copy of Submodule2, that I will edit. Submodule2 is the template that I want to base Submodule3 on. So what I want to do is clone Submodule2 inside Project on my local machine, make changes to it, then push it to the remote repo as Submodule3.

1

There are 1 best solutions below

3
On

Maybe this is documentation page that is of your interest. There you can read that

To add a new submodule you use the git submodule add command with the absolute or relative URL of the project you would like to start tracking. In this example, we’ll add a library called “DbConnector”.

$ git submodule add https://github.com/chaconinc/DbConnector
Cloning into 'DbConnector'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 11 (delta 0), reused 11 (delta 0)
Unpacking objects: 100% (11/11), done.
Checking connectivity... done.