Abhishek
Abhishek

Reputation: 2019

GIT Submodules feature without an existing path

I have created a project with structure as follows:

jQuery  
 - Timepicker  
 - Datepicker  
 - ScrollEvent  

I have one project named jQueryUtils which has 3 sub-modules within it and I should be able to checkout each of them seperately and work on it independently and track changes/commits done on each submodule.
I found a link which explains about GIT Submodules feature.
But the only issue is that each submodule should again point to an existing repo.

Is there any way we can checkout and work on each sub-module without actually creating seperate repo's for each sub-module.
i.e. Currently I can create 'n' number of modules in 'n' different repositories and then merge them into one project using GIT submodule feature,
But what I want is create 1 project in 1 repo with 'n' modules and then work on each of them individually and track all changes on each module.

Upvotes: 1

Views: 31

Answers (1)

Ionică Bizău
Ionică Bizău

Reputation: 113385

If you want to push the project on GitHub, the correct way to do this is using submodules pointing to other repositories from GitHub (or other similar service).

You can add submodules with a local remote, but they will not be accessible on GitHub, since they point to a local directory on your machine.

Like I mentioned in comments, creating repositories for each submodule is not a problem and it's not so hard to maintain as you expect.

See Nested git repositories without remotes (a.k.a. git submodule without remotes)

Upvotes: 1

Related Questions