This page shall give an introduction to the functions submodule and subtree of git. Both commands allow the inclusion of a remote repository into a so called host repository. In the following both commands are briefly introduced and compared. At the end a conclusion is drawn.
This pushes the changes to the external repository. Pushing to the remote can be tricky. Sometimes it fails. Leaving the user wondering why it fails. So it might be better to only change on the remote repository directly.
Neither for subtrees nor for submodules IntelliJ has support for. Pulling and pushing to the external repo needs to be done on the command line.
Switching between branches/tags needs to remove the directory first from the host and then add it again with git subtree add
Finally, the conclusion can be drawn that subtrees are better. The daily workflow does not need to be changed. Only if the updates from the external repository shall be included, special commands are necessary. An occasional user of the source code does not need to know anything about the subtree. Additionally, in contrast to submodules, it is possible to adapt the external code to the needs of the host project without changing the code on the external repository.