1

We have 4 repos with executables and when I clone any 1 of them, I want to also clone all of the 8 repos with libraries to the folders next to the executable folder. The executables are something like services, all 4 of them will use the latest versions from main repositories of the libraries. I also want to clone all of the 8 library repos when I clone any 1 of them.

So I can for example 
clone executable1 and have folders: 
executable1-library1-..-library8
or clone library1 and have folders: 
library1-..-library8
or end up cloning all of the executables and have folders: 
executable1-..-executable4-library1-..-library8. 

So I don't want to download all of the executables everytime, but I want to download all of the libraries everytime.

I have been thinking about submodules, but their documentation is terrible, maybe the whole feature is poor, I don't know. Then I have been thinking about subtrees and other structures from git. There is also a possibility that I will always just clone all of the 8 libraries separately manually, that would be sad.

So what is the best way to 
1) automatically download all of the 8 libraries to their folders (next to the folder of the executable if it was caused by cloning executable)?
2) automatically download all of the 8 libraries to their folders next to the folder of the executable during the cloning of the executable?

The first option is more basic - to have it done in 2 steps (1.executable+2.libraries), the second is way better for me, to just have it done in 1 step(executable&libraries together).

Part of my question was solved here: Git: Possible to use same submodule working copy by multiple projects?

I also want to make changes to the libraries even if they were downloaded with the executable and push those changes to their repositories.

EDIT: I added last sentence and added that also 1 library should also download other libraries.

Community
  • 1
  • 1
Lukas Salich
  • 959
  • 2
  • 12
  • 30
  • Submodules are regular git repositories: you can make branches, and add your commits and push. My answer stands. – VonC Nov 25 '16 at 08:33
  • Answer is good and I somehow expected that, but I thought that there will be more ideas and comparison between them etc, but noone is probably interested. I must think about that first and try it on some sandbox repo. – Lukas Salich Nov 25 '16 at 09:54

1 Answers1

1

You still can use submodule, and register them (in each repo) to follow their own master branch.

git submodule add -b master -- /url/library1

Then a simple git clone --recursive will be enough to get all submodule content back.
A git submodule update --remote will ensure they reflect their latest master branch state.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250