Difference between subprojects and submodules in Git?

In Git, is there a difference between a "submodule" (as created and managed by the git submodule command) and a "subproject" (literally just one Git repository that you put inside another Git repository), and if so, what is it?

All the documentation I've been able to find about this is rather ambiguous (and in some cases, contradictory). My suspicion is that there is no difference, but I figure I ought to confirm that and leave a question for Git newbies to find.


Solution 1:

A subproject is a generic term for one of three types of nesting:

  • Submodules provide semi-fixed references from the superproject into subprojects and are integrated into git. It is best used when the subproject:
    • is developed by someone else, is not under the administrative control of the superproject and follows a different release cycle.
    • contains code shared between superprojects (especially when the intention is to propagate bugfixes and new features back to other superprojects).
    • separates huge and/or many files that would hurt performance of everyday git commands.
  • Subtrees causes the subproject repository to be imported into the superproject's repository to be a native part of the repository with full history, typically in a specific subdirectory of the superproject.
  • Wrappers, which provide multi-repository management functionality to a superproject with associated subprojects.

Reference documentation