Staging OpenSG core changes through github pull requests

Work in progress

Initial setup

  • if you don't have one get an account at github (
  • rename or change the description if wanted. If you rename it you have to replace the OpenSGDevMaster name below by your new name where it refers to your forked repositiory, e.g. it should than be<your login>/<your new repository name>

  • get the url of the fork from the main page of the fork,

e.g.<your login>/OpenSGDevMaster

  • clone the fork to your local disk using the private url, e.g.

git clone git@…:<your login>/OpenSGDevMaster.git

at this point you have a local development copy which you can sync with github (git fetch / git push).

In order to track the main DevMaster repository you forked from, you have to add the original DevMaster as an upstream source using the public url of the original repository, this must be done for every local clone individually :

  • go to your fresh checkout
  • add the main DevMaster repository as upstream:

git remote add upstream git://

and fetch the upstream branch

git fetch upstream

at this point you will have three branches on your local machine and are ready to go (check for example with 'gitk \--all'):


your local development branch


the remote head of the forked repository,

e.g.<your login>/OpenSGDevMaster


the remote head of the original DevMaster repository you forked from,

e.g. git://

Local development

edit, compile, test and commit your changes locally as usual. Once you are happy with the results push them to your forked repository:

git push origin master

But we would suggest that you push early, even if you are not 100% happy or if it does not work perfectly, to enable us to give early feedback. Just push what you have and ask for feedback either on the mailing list or privately. We also suggest you keep a osg_head branch both locally and remotely so one can easily track from where your branch deviated.

Alternatively you could add a github target to your .git/config file

[remote "github"]

url = git@…:<your login>/OpenSGDevMaster_Toolbox.git
push = master:master
push = osg_head:osg_head

and push using

git push github

Tracking upstream changes

Once the upstream repository changes there are basically 3 ways to track these changes

  • merge
  • rebase
  • cherry-pick

As merging usually creates a non-linear history the preferred ways are either to rebase you local changes or to cherry-pick your changes on top of the upstream head. Which one to use mainly depends on the underlying upstream changes.

The more convenient one is rebase as it takes all of your changes and puts them on top of the upstream head. During this process you are able to resolve any of the merge conflicts. The drawback is that if some of your changes where merged back into upstream in a modified form this might leave snipset patches lying around that don't fullfill any purpose. In this case might be easier to isolate the patches in your branch and cherry-pick the remainder.

Given the following repository state:

osg_head is the head of the upstream OpenSG repository and master is the head of the branch with the local changes.

Bring the master branch back on top of osg_head:

git checkout master
git rebase osg_head

In this case there are overlapping commits readding the setPrototype function to FieldContainerType. The most efficient way is to split the operation, rebase everything up to

c7fb7a5d57b777978285cdf9ebcfff249b6419d4 Added: Added EventProducer as a friend of TypeBase.

and cherry-pick the rest leaving out the conflicting commit

Added: setPrototype method to FieldContainerType.

git branch tmp_head c7fb7a5d57b777978285cdf9ebcfff249b6419d4
git checkout tmp_head
git rebase osg_head
git cherry-pick 85e063c03e71084a1ec2338ef6de3e9a6a532a17

Added: Matrix22 class.

git cherry-pick e1f23edcdae712e1e74378fe47687c7c9d3d30bc

Fixed: Various Windows build problems.

git cherry-pick c3e2bbec1c7df78b0a9b875d3424b39bc7196788

Fixed: Added Viewport as friend of DrawEnv

git cherry-pick 9e23bd0f6dc4014e1f10bc115666b125bf0c9659

changed: adjusted ref cache

git branch -f master
git checkout master
git branch -d tmp_head

Now the repository is ready to be pushed,

as we changed the history we have to commit with -f, hence, first check if there were any changes in the meantime

git fetch

if nothing is there

git push -f github

Get it back to the core OpenSG tree

Send us a pull request via github.

Please send this to a resonably small subset of people listed, right now Gerrit or Carsten but not to everybody who forked the original repository and is just following along. You can also send the request to the mailing list.

Last modified 7 years ago Last modified on 04/09/10 14:42:09

Attachments (2)

Download all attachments as: .zip