


Again this works when updates are not too frequent. When you are delegating a piece of the project to a third party and you want to integrate their work at a specific time or release.When you have a component that isn’t updated very often and you want to track it as a vendor dependency.
Git submodule add example code#

gitmodules file contains meta data about the mapping between the submodule project's URL and local directory. When adding a submodule to a repository a new. Submodules do not track git refs or branches and are not automatically updated when the host repository is updated. Submodules are very static and only track specific commits. Both of these suggested incorporation methods do not enable tracking edits and changes to the external repository.Ī git submodule is a record within a host git repository that points to a specific commit in another external repository. 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.
