Submodules vs Subtrees in Git
Created on 2020-09-03T08:15:19+00:00
Submodule
- A submodule is a pointer to another git repository.
- The URL and SHA sum is kept in the parent repository.
- Submodules use the `git submodule` command.
- Submodules need special treatment; they are separate repos, and so must be checked out and updated with appropriate commands.
Subtree
- A subtree embeds another git repository entirely.
- A subtree may mix the histories of two repositories or it may be squashed.
- A squashed subtree holds only a single commit of the original repository.
- Subtrees require the `git-subtree` scripts be installed to create or update, but not use.
- A subtree is like any other file in the repo and needs no special treatment, aside from when created or updated.