Git · Senior · Question 18 of 76
Submodule vs subtree: what's the key trade-off?
- 1They are identical but subtree works only on GitHub
- 2Submodules copy the code; subtrees only store a URL
- ✓Correct answer: Submodules pin a separate repo; subtree copies code into yours
Explanation
Submodules keep histories separate but require extra commands from everyone. Subtree merges the other project's files into your history, so clones just work, but syncing back upstream is harder.