IT lexicon › Programming › git subtree

git subtree

Programming På svenska → Updated: 2026-11-14

Git command for embedding an external repository's history as a subdirectory in a main repository.

Git subtree allows a project to include code from another Git repository as a subdirectory with full history squashed into the main repository's commits. Unlike git submodule, which stores a reference to an external repository, subtree bakes in the code directly—no checkout of external dependencies, simpler but messier history. It's useful for including third-party libraries or themes that need local modifications, though merging updates back upstream requires careful handling.

← Back to the lexicon