Anoop
Anoop

Reputation: 1305

How to nest git repositories?

I have a parent git repo which contains files common to my product. Now when I deploy I will need to add customizations based on the client I'm deploying for. The customizations lie at different parts of the parent structure as different sub-folders (a 'feature' of the framework I'm forced to use). Is it possible to split my repo into 'parent-repo', 'client1-customization', 'client2-customization' etc.

To make it clear: My directory structure is as below:

myproject
-- .git
-- web
   -- client1
   -- client2
   -- common
-- lib

I want it as:

myproject
-- .git
-- web
   -- client1
      -- .git
   -- client2
      -- .git
   -- common
--lib

How can this be achieved?

Upvotes: 1

Views: 435

Answers (2)

kusma
kusma

Reputation: 6658

Yes, if you use submodules. See the git community book for details.

Upvotes: 4

nulltoken
nulltoken

Reputation: 67589

Ayende shared some experience about this topic and recommends git subtree over submodules

see below for further reference:

Upvotes: 2

Related Questions