Difference between subprojects and submodules in Git?

Git

Git Problem Overview


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.

Git Solutions


Solution 1 - Git

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser597474View Question on Stackoverflow
Solution 1 - GitJustin ᚅᚔᚈᚄᚒᚔView Answer on Stackoverflow