Git submodules, subtrees and monorepos: sharing code across repos
10 steps · about 2 h 25 min · Intermediate
- Monorepo vs Polyrepo (article, Nx, 10 min)
Starts with the big picture: where code lives, and why that choice shapes how you share dependencies.
- Monorepo vs Polyrepo: Pros, Cons & How to Choose (2026) (article, Sourcegraph, 12 min)
A second view on the trade-offs, covering the build and discoverability problems each approach creates.
- What Is a Monorepo? Monorepo vs Polyrepo (2026 Guide) (article, Repowise, 10 min)
Clears up the common mix-up between a monorepo and a monolith, and shows the hidden problems a monorepo can build up.
- Git Submodules (tutorial, W3Schools, 10 min)
A short, runnable first look at add, clone, status and foreach before the deeper material.
- Git - Submodules (doc, Pro Git (git-scm.com), 40 min)
The official reference on how submodules work, including the pitfalls such as detached HEAD and switching branches.
- Using submodules in Git - Tutorial (tutorial, vogella, 15 min)
Gives practical command recipes for cloning, pulling and updating nested submodules.
- How to manage Git submodules (guide, Graphite, 10 min)
Covers day-to-day management, such as tracking branches and recursive updates, once you know the basics.
- What Are Git Subtrees? (article, Tower, 8 min)
Introduces subtree as the main alternative, with the add and pull commands.
- Git Submodule vs. Git Subtree: The Definitive Guide (article, Saeed Vayghan, 15 min)
A side-by-side comparison that sets out the trade-offs between the two approaches.
- Git Submodules and Subtrees: When to Use Each (article, Grizzly Peak Software, 15 min)
Finishes with a decision guide that includes packages, CI impact and the slowness of subtree push.