3

I have a repository for each micro-services ('A', 'B', ..). The structure of a repository looks like :

A
|-dockerfile
|-src
  |-Java
  |-Groovy

Since all of these repositories belongs to a project called 'WholeProject', I want to maintain a repository 'WholeProject' which looks like :

WholeProject
|-docker-compose.yml
|-µS
  |-A
  |-B
  |-..

So I could easily maintain a docker-compose file and a repository that contains all the revelant things about my project.

Is this a good idea ? How can I perform that ?

DouglasAdams
  • 490
  • 7
  • 19

1 Answers1

1

You could consider using git submodules with:

cd /path/to/WholeProject
git submodule -- /url/to/repo/A µS/A
git submodule -- /url/to/repo/B µS/B

That way, you can clone WholeProject with a:

git clone --recursive

And you get A and B at their last recorded SHA1.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks ! That works and that answer my question. But I'm wondering if it is a good idea or if there is another better strategy to apply.. ? – DouglasAdams Jul 06 '16 at 13:51
  • @DouglasAdams The alternative, if you want a monorepo, is subtree: http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/ https://developer.atlassian.com/blog/2015/05/the-power-of-git-subtree/ (but if A and B have different lifecycles, that is different branches and tags, submodules are a better fit) – VonC Jul 06 '16 at 13:53