This method has the downside of requiring installation and version management at all places the origin code is deployed. Another method of incorporating external code is through the use of a language's package management system like Ruby Gems or NPM. This method has the downside of losing any upstream changes to the external repository. The external code can be directly copied and pasted into the main repository. This external code can be incorporated in a few different ways. Often a code repository will depend upon external code.
Git submodules enable a Git repository to incorporate and track version history of external code. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules allow you to keep a git repository as a subdirectory of another git repository.