I'm very new to git, I use it through gitHub, and I wanted to know if there's a way to create a sub-repository that is then included in the main one. For example, if I have a library with modules, I'd like some of them to be in a repository on their own, with issues and all the features offered by git, but at the same time I want them to be included in the library repo. How can I do this?
Asked
Active
Viewed 60 times
1
-
Is [submodules](http://git-scm.com/book/en/v2/Git-Tools-Submodules) maybe the feature you're looking for? – Frxstrem Apr 28 '15 at 12:09
1 Answers
3
I think you are looking for git submodules.
Basically, each of the libraries you mention will be added as a submmodule. Each such submodule will have a repository of its own, and the master repository will reference this via the entry in the .gitmodules
file.
As @Chris mentions in comments below, you may want to explore git subtrees as well.

Anshul Goyal
- 73,278
- 37
- 149
- 186
-
1Submodules are indeed a good option here. Many users prefer [subtrees](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/), and they're worth a look too. – ChrisGPT was on strike Apr 28 '15 at 12:45
-
Is there a way to configure it via gitHub or should I download the git shell? – Phate01 Apr 29 '15 at 08:22
-
@Phate01 You can use the [`git-bash`](http://stackoverflow.com/q/16757393/1860929), which comes in pre-installed with git for windows. I'm not really sure on configuring this using `github` tool. – Anshul Goyal Apr 29 '15 at 08:45