Git Upstream Ports

We’ve recently added a number of git repositories at github to track ports of various software tools to our platform. These are the steps that we used to get things working. We will use the binutils port as an example.

Create
For consistency, we’ll name all our upstream code as upstream for obvious reasons.
Instead of tracking everything, it might be more beneficial to just track the upstream master branch as we only want to track the main development code.
To create the initial repository, these steps are used:

$ mkdir binutils-port.git
$ cd binutils-port.git
$ git flow init
$ git remote add upstream -t master git://sourceware.org/git/binutils.git
$ git remote add origin [email protected]:aeste/newlib-port.git
$ git push -u origin master
$ git push -u origin develop

Upstream
We would like to only work off stable releases.
Therefore, instead of merging the complete upstream branch, we’ll only merge in stable code tagged as official releases.
To fetch and merge stable upstream code, use these steps:

$ git fetch upstream
$ git fetch upstream --tags
$ git tag
$ git show-ref binutils-2_22
$ git checkout develop
$ git merge XXXXXXXX

Modifications
Use the standard git-flow model to make modifications to the code. To merge the code from future upstream stable releases:

$ git fetch upstream
$ git fetch upstream --tags
$ git tag
$ git show-ref binutils-X_XX
$ git checkout develop
$ git merge XXXXXXXX

Push
Once the code is ready it needs to be pushed up to github.
This should be done as and when necessary, particularly after major releases or hotfixes.
For this example, we’ll push up two public branches and a tag (12.02).

$ git push -u origin master
$ git push -u origin develop
$ git push origin 12.02

That’s it.

You may also like...

Leave a Reply