Skip to main content

Git's own tools

Each comparison takes one example through a tool until it hits the tool's pain points, then shows how git-splice handles them in the same example. The example is a monorepo with an app that uses a library, https://git.example.com/lib.git, with 30 commits. You put the library into a folder of the monorepo, fix it together with the app, send the fix back, and take in the library's own changes. Every page starts from the same repositories, built by scrut-setup.sh.

Git comes with two tools for this, compared with git-splice point by point:

git submodulegit subtreegit-splice
Library files in the monorepono, a gitlinkyesyes
status, diff, log of library filesstatus: never; diff, log -p: with --submodule=diff; log -- <file>: neveryesyes
Fix to app and librarytwo commits, two pushes, library firstone commitone commit
Library history in the monorepononewhole, or squashed into a mergenone, one commit per sync
Monorepo historylinearmergeslinear
Push walksnothing, the library is its own repositorythe monorepo's history since the last known library committhe commits since the boundary
Second worktreeinitialize again, submodule.* settings shared, can't be movedworksworks
Best forlibraries kept apart, with their own accessmoving a repository in for good, history includedchanging a library in the monorepo and sending the changes back