Subtrees
Create, Pull, and Backport Subtree
Section titled “Create, Pull, and Backport Subtree”Create Subtree
Section titled “Create Subtree”Add a new remote called plugin pointing to the plugin’s repository:
git remote add plugin https://path.to/remotes/plugin.gitThen Create a subtree specifying the new folder prefix plugins/demo. plugin is the remote name, and master refers to the master branch on the subtree’s repository:
git subtree add --prefix=plugins/demo plugin masterPull Subtree Updates
Section titled “Pull Subtree Updates”Pull normal commits made in plugin:
git subtree pull --prefix=plugins/demo plugin masterBackport Subtree Updates
Section titled “Backport Subtree Updates”git commit -am "new changes to be backported"git checkout -b backport plugin/mastergit cherry-pick -x --strategy=subtree mastergit push plugin backport:masterSyntax
Section titled “Syntax”git subtree add -P <prefix> <commit>git subtree add -P <prefix> <repository> <ref>git subtree pull -P <prefix> <repository> <ref>git subtree push -P <prefix> <repository> <ref>git subtree merge -P <prefix> <commit>git subtree split -P <prefix> [OPTIONS] [<commit>]
Remarks
Section titled “Remarks”This is an alternative to using a submodule