I think I've found a simple way to work across several Git repositories from one monorepo. You need this when, for example:
- you have a private monorepo with some public folders (my case),
- you vendored a library and want to send a patch back to it,
- you use Git submodules and are tired of them.
The idea is a three-way merge on a folder: merge the other repository's tree into the folder, with the tree from the last sync as the merge base. The two repositories share no history and don't need to know about each other.
Josh, by contrast, works on one shared history. The chapter "Comparisons" in the docs compares this with submodules, subtree, git-subrepo, Josh, Copybara, Sapling and jj.
I've been working on this for a month now, testing the workflows with executable scenarios: https://roschaefer.github.io/git-splice/
Disclaimer: yes, AI helped write the code and the executable scenarios. I read their tests and diagrams until I understand each case.
Everything this needs has been in Git all along. I'm surprised I haven't found a tool that works this way, while people have been frustrated with submodules for years.
So, Reddit: where does this approach fall apart? Have I missed something fundamental?
Edit: Two people asked how this differs from git subtree, so I updated its page in the docs, with drawings of the commit graph: https://roschaefer.github.io/git-splice/test/comparisons/git-subtree/
In short: if you keep the library's history out of the monorepo with --squash, split walks the monorepo's whole history on every push, so it won't scale. And the usual git subtree workflow doesn't give you a linear history: add, pull and split --rejoin always create merge commits.
The git submodule page got the same treatment: https://roschaefer.github.io/git-splice/test/comparisons/git-submodule/