Git SVN Workflow

For some of our projects, FreeRTOS specifically, we need to track a SVN upstream repository that is hosted on Source Forge. As we’re only interested in pulling upstream changes and not pushing anything upstream, this simplifies our workflow a bit.

The first thing that is needed is to configure the upstream SVN repository. In our case, we already have an existing git repository. Therefore, instead of cloning the actual SVN tree, we’ll only pull in the necessary changes.

$ cd freertos-port.git
$ git svn init -s

Fetching the entire SVN history would take ages. Therefore, we’re limiting the fetch to only the more recent releases (r1611 onwards). This operation will take a little time. Time to grab a coffee break.

$ git svn fetch -r 1611:HEAD

Next, we need to merge in the upstream code. We only work of stable upstream releases, which are tracked as specific SVN branches. This can be done by merging the remote branches directly.

$ git branch -a
$ git checkout develop
$ git merge remotes/tags/V7.0.2

Periodically, new code needs to be pulled from the upstream repository. This will only be done to track a new stable upstream release. This can be accomplished using the following method:

$ git svn fetch
$ git checkout develop
$ git branch -a
$ git merge remotes/tags/V7.1.0

Otherwise, we use git-flow as usual. Once things are done, push any changes up to github.

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

You may also like...

Leave a Reply