1

I know there are a lot of questions for "how to nest git repos", and most of them recommend submodules. However, all the code snippets I've seen have the submodule connected to a separate git url. In my case, my only git remotes are on GitHub, but I would like the submodules to not be visible in the index. Admittedly my reasoning for this is somewhat shallow; I have over 150 repos and I want to combine a bunch of them to make the list more navigatable. However I don't want to lose the revision histories.

Right now I see only two options, neither of which seems suitable:

  1. Merge all the commit histories into a single tree
  2. Keep the status quo, where every repo is viewable through Github.
max pleaner
  • 23,403
  • 8
  • 50
  • 99

3 Answers3

1

No.

A “GitHub repo” is exactly one Git repo. While there are ways to sort of achieve this using Git (via submodules or merging the repos into one), but you’ve already eliminated them as non-viable.

Andrew Marshall
  • 89,426
  • 20
  • 208
  • 208
1

Merge all the commit histories into a single tree

That is the monorepo approach, and you see that used more and more by big organization (Facebook, Google, Microsoft)

Microsoft has one giant Git repo for Windows, but that is because it uses GVFS (Git Virtual FileSystem)

In your case, you can try and merge your repo (with git subtree for instance) (or, as another option, some merge --squash)

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
1

You can treat the whole repositories like just one using subtrees.

I think solution could be subtrees. With subtree you can develop in your central repository also elements stored in others repository.

This means that you can have

  • main project
  • component A
  • component B

You can put components A and B in separates repository. With their own readme file and so on. Those are not independent libraries: are just a part (a sub tree) of your project.

update the component X

To update the component X you can just clone the component and update it. But wait, ... this is a bit confusing so, ... you can just pull subtree inside main git repository and push the subtree in its remote.

sensorario
  • 15,862
  • 24
  • 85
  • 131