Reputation: 1224
Linux has lots of git repositories for different modules as listed here. There are also repositories for developers. But how does Linus merge all of these repositories and make a single kernel repository like this? For instance, does he mark as submodule all of the related repositories or what?
Upvotes: 0
Views: 41
Reputation: 476503
git
thinks the opposite way: instead of generating a "master" repository, one generates "children" repositories called submodules
.
Say that you have two git
repositories that are located at:
foo.bar/baz
quix.qu/foobar
Then you can initialize a parent git repository (for instance in parent
):
git init .
and add submodules:
git submodule add foo.bar/baz
git submodule add quix.qu/foobar
It will create the baz
and foobar
directory and initialize the appropriate git repositories there. The resulting tree
is thus something like:
parent
├── baz
│ ├── content of baz
│ └── other content of baz
└── foobar
Submodules are thus what are links (shortcuts) in a non-versioning file system. They are useful if a part of a project tend "to go its own way" and commits are no longer global but you want commits to only capture for instance the plugins
directory.
Upvotes: 1