Submodules vs. Subtrees

🔍 What you'll learn: Need to include external code in your repository? Git offers two strategies—submodules (linking) and subtrees (copying)—with very different tradeoffs. This demo compares them side-by-side so you can choose wisely.

1
The Goal: Managing Dependencies

Your project (`Parent Repo`) needs to include code from another repository (`Library Repo`). How do you manage this relationship? Let's explore two common Git strategies.

Parent Repo

P1
P2
main

Library Repo

L1
L2
main
Key Point: You want to use the code from `Library Repo` inside `Parent Repo`, but you also want to be able to easily update the library code as it changes.