OP's complaint isn't a mono repo one. You only get merged conflicts if people changed the exact same files as you. That will happen regardless of repo type. All you can do is avoid having multiple devs working in the same area at the same time.
I work in a mono repo and it's amazing. Alternatives like git subrepos suck and are confusing. While you do have more instability because of changes in dependencies, it also means you're catching those issues earlier, which is easiest. It's easier to prevent those incompatibilities in a mono repo due to the ease of running tests at the current main version. Also easier to fix other team's issues and extend tooling and such because you don't need to figure out their repo and as much of their workflow, etc.
For me it’s having everything in a review in one place. So much better, and contrary to OPs experience, has made getting a review markedly easier. I just have to chase one person instead of putting together a strike team every time. Though that may be more because it came together with dissolving hard lines between projects on our small team (Conways law in full effect)
Merge conflicts often happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file.
As someone who will happily rant about the superiority of the tab, I still have to admit that repository structure matters a good deal more. Sure, you can do anything if you invest in tooling, but you can do it ten times faster if you just choose the model that fits existing tools.
The aforementioned merge queues vs syncing changes between repos
Access control woes
Having to do a sparse/shallow checkout due to size vs having to checkout three repos to work on one service
Seeing PRs, alerts, etc. you can't do anything about vs having to check for them in multiple places
People thinking that backwards compatibility doesn't matter for a service if you update the client in the same PR (users won't get the new client immediately...)
Just because you can doesn't mean you should. As I said, tools exist that support particular models of work already, e.g. most GitHub features are organized around repositories. There are probably ten or so companies in the world that can justify building their own source control platform, but the rest should design their work around one of the existing ones.
I'm sure however theyve set it up they could keep the monorepo and quash the persistent merge conflict problem somehow.
Yeah this is the confusing thing to me
Being a monorepo doesn't inherently mean PRs will have persistent conflicts. It just sounds like a bad setup of some sort, or projects not getting properly scoped
Like right now another team is working on an area of the codebase that my team also wants to be updating for a project. So we shuffled projects around and they're going first, sticking us on all the PRs. We've taken a different project on instead, and we'll touch the shared code in the new year 🤷♂️
monorepo done well doesn't expose this kind of problems, you'd have them as well in a polyrepo setup on the specific app/component affected by the conflict
Multi repo structures have the exact same problem; instead it's distributed between 10 repos & prs AND you're almost guaranteed to hit conflicts on the files specifying out the versions between repos (since literally everyone is forced to touch those files).
Multi repos are effectively just monorepos but with 10x the work handling merges and versioning between them.
View all comments
6
u/za72 27d ago
so why use monorepo??