This tutorial is inspired from this post on stackoverflow
I explain here how I subtreed the aircraft Citation X from the PAF Team addons repository
There will be 3 branches involved:
- master the local+remote master branch containing my version of the aircraft.
- upstream-master the local branch tracking the entire upstream PAF addons repository.
- upstream-CitationX the local+remote split branch, contains only the part of the upstream repository that is related to CitationX. This branch is a kind of inteface/filter.
git subtree split
is the magic tool that is used to extract from upstream master only what is related to CitationX
- Clone the entire repository using
git clone git://git.code.sf.net/p/pafteam/addons pafteam-addons
- Rename the master branch
git branch -m master upstream-master
- Create a branch upstream-CitationX that only contains the folder Aircraft/CitationX of the active branch
git subtree split --prefix=Aircraft/CitationX --onto upstream-CitationX --branch upstream-CitationX
- The remote origin is pointing to upstream, therefore we need to rename origin:
git remote rename origin upstream
- Create a Git repository that will contain fy fork/subtree of pafteam-addons CitationX and add as origin
git remote add origin [email protected]:adessein/citation-x.git
- Fetch and push the subtree branch
git fetch origin
git push -u origin upstream-CitationX
- Create my master branch and push it to
origin
git checkout -b master
git push -u origin master
- Checkout the
upstream-master
branch and pull
git checkout upstream-master
git pull
- Update the filtered branch
upstream-CitationX
git subtree split --prefix=Aircraft/CitationX --onto upstream-CitationX --branch upstream-CitationX
- Merge
upstream-CitationX
intomaster
git checkout master
git merge upstream-CitationX