Creating and applying a patch for an Eclipse project with Git, part 2 : using github
As of today, pull requests are not accepted by Eclipse committers since they lack IP (Intellectual Property) information, and the official git repositories at eclipse are hosted by the foundation not on github (github repositories of Eclipse projects exist for mirroring only).
Recently talking with a committer on the Eclipse Tycho project (Tobias Oberlies not to name him), he suggested to me to share my contributions via github, instead of attaching patches, as long as the git contribution scenario is followed
To comply with this suggestion,
1. I would clone the official repository at git.eclipse.org
git clone http://git.eclipse.org/gitroot/tycho/org.eclipse.tycho.git
2. work on my changes, test them, add them, and commit them for each functional change
git add myfile1 myfile2
git commit -m "BZ xxxxxx : comment"
4. synchronize my new github repo with the official tycho repository
git remote add origin.github email@example.com:anthonydahanne/org.eclipse.tycho.git
“behind proxy” users can use https access instead,
git remote add origin.github https://firstname.lastname@example.org/anthonydahanne/org.eclipse.tycho.git
5. push my committed changes to my github repository
git push -u origin.github master
6. add a comment to the bugzilla entry describing the fix or new feature I worked on, giving the github commit id
That’s it ! you just contributed some code to a cool Eclipse project !
OK, it seems more complicated than just submitting a patch or a pull request, but once your local repo is set up,
you should have something like :
git remote -v
origin http://git.eclipse.org/gitroot/tycho/org.eclipse.tycho.git (fetch)
origin http://git.eclipse.org/gitroot/tycho/org.eclipse.tycho.git (push)
origin.github https://email@example.com/anthonydahanne/org.eclipse.tycho.git (fetch)
origin.github https://firstname.lastname@example.org/anthonydahanne/org.eclipse.tycho.git (push)
and it is just a matter of juggling between the original repo, synchronizing the latest changes
git pull origin master
and the github repo (pushing the latest changes)
git push origin.github master
and copying/pasting the commit ids to the bugzilla entry.
I’m still relatively new to Git, so if you think there are better ways to sync the repositories, then please add a comment to this post !
To go deeper on that topic :