-1

I want to combine several thematically related but otherwise independent repos under one root folder, while at the same time keeping their histories seperate.

The end result should look like this

root
   >repo1
      >.git
      >...
   >repo2
      >.git
      >...

or this.

root
   >.git
   >repo1
      >.git
      >...
   >repo2
      >.git
      >...

where I want to be able to download or clone the root collection from github and get exactly that structure locally.

I prefer the first solution - but is it feasible and how?

Oblomov
  • 8,953
  • 22
  • 60
  • 106
  • 1
    One problem i see with option 2 is that if you commit to repo1 or repo2, you will have to commit to root each and every time as well.... – Preston Martin Sep 20 '17 at 14:42
  • 1
    Asking `Which is the best` is strictly off-topic, as it tends to attract opinionated answers, not based on factual reasoning. – ifconfig Sep 20 '17 at 15:57
  • Thanks for the hint, I have updated the original question. – Oblomov Sep 20 '17 at 16:13

1 Answers1

1

You could work with submodules as described in https://git-scm.com/book/en/v2/Git-Tools-Submodules. This would be the second approach. I would recommend this option to you.

If you want the first option, you need to write a script, that generates this kind of structure. You cannot push the first solution to github as the root folder is not a git repository.

MxNbrt
  • 317
  • 3
  • 12