gitmagentogit-submodulesgit-subtreegit-slave

How to create two Git repositories in the same base directory, without using branches?


We are currently in the process of moving our Magento Enterprise (an e-commerce web application) files into Git. The httpdocs/.gitignore file contains, among other things:

app/design/frontend/company/website/
skin/frontend/company/website/

After initializing, committing and pushing httpdocs/, our first Git repository was successfully created. We now want to put both of the aforementioned directories into their own, separate repository. (Together, in a single repository!) The problem we run into here is that these directories share a common root that already contains our first Git repository; that is: httpdocs/

I've read it is possible with the submodule functionality to embed other repositories within subdirectories of existing trees. However, the documentation at for example kernel.org and git-scm.com seems so complicated that it makes me wonder whether this is really the way to go forward. All we need is two separate repositories, they just happen to have the same root.

Another possible solution I've read about might be to initialize from app/design/frontend/company/website/ and add skin/frontend/company/website/ as a graft point in order to join these directories together. However, again, this seems overly complicated, and intended rather to be used when moving from another revision control system to Git.


Solution

  • You will have to use submodules or link the different repositories by sub tree merges.

    If you go the submodule route, consider using gitslave as it will save you a lot of manual steps if you are actively developing both repositories.

    Hope this helps.