4

I am looking at setting up git repositories but am coming from a background in SVN.

Here is what I want:

Product Repositories - These capture stand alone individual products (an application, a library for example)

  • Application A
  • Application B
  • Library C
  • . . .

Project Repositories - These capture aggregations of products to form a solution for a particular customer.

  • Project X repository
  • Project Y repository
  • Project Z repository
  • . . .

Each project will be built up of different combinations of products. For example, Project X is built up of Application A, Application B, and then some project specific code. Project Y is build up of Application B, Application C, and Application D with project specific code and settings. You get the idea.

In SVN, the project repositories would use SVN-externals to include a version of the products.

Can I accomplish this with the repository concept I detailed above or should I be thinking of a completely different technique given the power of git?

ImaginaryX
  • 41
  • 3
  • This is certainly a useful question (and well-stated), but I do think that [Git Setup Best practices](http://stackoverflow.com/questions/9282998/git-setup-best-practices) possibly duplicates it. You may also find [this question](http://stackoverflow.com/q/2732020/899126) useful – Chris Forrence Nov 19 '14 at 15:46
  • Possible duplicate of http://stackoverflow.com/questions/5514739/best-practice-for-git-repositories-with-multiple-projects-in-traditional-n-tier –  Nov 19 '14 at 16:24

2 Answers2

3

Consider using Git Submodules. Details can be found in Submodules chapter of the free online Git book. Quoting from the book:

Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.

1

in my company we ran into the same problem. We solved this be rethinking the way our repositories were structured and used. In particular:

  • common code became shared libraries
  • we started using a package managment system (rpm) which allowed to introduce dependences. eg: project X has its own files, but also depends on package A and library C
Chris Maes
  • 35,025
  • 12
  • 111
  • 136