

A subtree is a sub directory that may be committed to, branched, and merged in any form you choose doing your super project. Subtrees allow subprojects to be contained under a subfolder of the parent project, the same happens with the subproject. Git submodule change branch A great alternative – git subtreeĬonsider your Git repository to be a tree, and a subtree is a smaller version of the main tree. If there are nested submodules, do the following: If you’ve previously cloned a repository and wish to load its submodules, use: gitmodules.įor example, to clone a repository with submodules, use: When the changes aren’t too frequent, this method works well.įirstly, create a new submodule using the git submodule command that saves the path and hyperlink references in a folder called. When you delegate a project component to a third party and wish to include their work at a certain time or release.When you wish to track a vendor dependence for a component that isn’t automatically updated too often.
#Git submodule get code#
#Git submodule get how to#
What is git submodule – why and how to use it?Ī Git submodule is a separate repository within a repository, to put it simply. We will show you the key differences, so you can decide which choice is the best for you.

This post was written to assist you in managing projects using Git subtree and submodule. When such a thing happens, you want to keep both projects distinct yet you want to be able to use one of them in a different one.

It might be a library built by other developers, or a piece of the project developed independently and then reused in several projects. While working on a project, it’s common to have it combined with another one, especially if you work in a network with other people.
