Course Tonight

Course Tonight

Did You Know?

Advanced visual search system powered by Ajax

Chapter 27: Subtrees

Estimated reading: 1 minute 6 views

Section 27.1: Create, Pull, and Backport Subtree

Create Subtree:

Add a new remote called “plugin” pointing to the plugin’s repository:

git remote add plugin https://path.to/remotes/plugin.git

Then 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 master

Pull Subtree Updates:

Pull normal commits made in plugin:

git subtree pull --prefix=plugins/demo plugin master

Backport Subtree Updates:

  1. Specify commits made in the superproject to be backported:
git commit -am "new changes to be backported"
  1. Checkout a new branch for merging, set to track the subtree repository:
git checkout -b backport plugin/master
  1. Cherry-pick backports:
git cherry-pick -x --strategy=subtree master
  1. Push changes back to the plugin source:
git push plugin backport:master

Leave a Comment

Share this Doc

Chapter 27: Subtrees

Or copy link

CONTENTS