• Facebook does not use Git due to scale issues with their large monorepo, instead opting for Mercurial.
  • Mercurial may be a better option for large monorepos, but Git has made improvements to support them better.
  • Despite some drawbacks, Git usage remains dominant with 93.87% share, due to familiarity, additional tools, and industry trends.
  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    14
    arrow-down
    2
    ·
    4 months ago

    That brings more problems. Despite the scaling challenges monorepos are clearly the way to go for company code in most cases.

    Unfortunately my company heavily uses submodules and it is a complete mess. People duplicating work all over the place, updates in submodules breaking their super-modules because testing becomes intractable. Tons of duplicate submodules because of transitive dependencies. Making cross-repo changes becomes extremely difficult.

    • bellsDoSing@lemm.ee
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      But if not for using submodules, how can one share code between (mono-)repos, which rely on the same common “module” / library / etc.? Is it a matter of “not letting submodules usage get out of hand”, sticking to an “upper limit of submodules”, or are submodules to be avoided entirely for monorepos of a certain scale and there’s a better option?

      • nous@programming.dev
        link
        fedilink
        English
        arrow-up
        4
        ·
        4 months ago

        You don’t share code between monorepos, the whole point of a monorepo is you only have one repo where all code goes. Want to share a library, just start using it as it is just in a different directory.

        Submodules are a poor way to share code between lots of small separate repos. IMO they should never be used as I have never seen them work well.

        If you don’t want a mono repo then have your repos publish code to artifact stores/registries that can be reused by other projects. But IMO that just adds more complexities and problems then having everything in a single repo does.

        • bellsDoSing@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          4 months ago

          So AFAIU, if a company had:

          • frontend
          • backend
          • desktop apps
          • mobile apps

          … and all those apps would share some smaller, self developed libraries / components with the frontend and/or backend, then the “no submodules, but one big monorepo” approach would be to just put all those apps into that monorepo as well and simply reference whatever shared code there might be via relative paths, effectively tracking “latest”, or maybe some distinct “stable version folders” (not sure if that’s a thing).

          Anyway, certainly never thought to go that far, because having an app that’s “mostly independant” from a codebase perspective be in it’s own repo seemed beneficial. But yeah, it seems to me this is a matter of scale and at some point the cost of not having everything in a monorepo would become too great.

          Thanks!

          • FizzyOrange@programming.dev
            link
            fedilink
            arrow-up
            2
            ·
            4 months ago

            Yeah exactly that. Conceptually it’s far superior to manyrepos. But it does have downsides:

            • git will be slower, and it doesn’t really have great support for this way of working. I mean it provides raw commands for partial checkouts… but you’re kind of on your own.
            • You can’t realistically view a git log --graph any more since there will be just way too many commits. Though tbf you can get to that state without a monorepo if you have a big project and work with numskulls who make 50 commits for a small MR and don’t squash.

            Also it’s not really a downside since you should be doing this anyway, but you need to use a build tool that sandboxes dependencies so it can guarantee there are no missing edges in your dependency graph (Bazel, Buck, Pants, Please, Landlock Make, etc.). Otherwise you will be constantly breaking master when things aren’t checked in CI that should be.

            • bellsDoSing@lemm.ee
              link
              fedilink
              English
              arrow-up
              1
              ·
              4 months ago

              True, git itself can’t prevent people from creating a mess of a commit graph.

              TBH, lots of build systems mentioned here I’ve never encountered so far. But this makes it clearer that one can’t reason about how viable a “one big monorepo only” approach mighy be by just considering the capabilities of current git, coming from a “manyrepo” mindset. Likely that was the pitfall I fell into coming into this discussion.