I’m on a rampage for the last two days… sort of. Why? I’m preparing for a free webinar on using LOD-enabled Open Refine (LODRefine) and I had to fix some issues (bugs) due to migration of LODGrefine from Google Refine to OpenRefine… OpenRefine used to be called Google Refine, endorsed by Google and hosted on Google Code… but it is not anymore. Now it’s on GitHub. Yay!
svn is dead, long live git?
On GitHub you can fork a repo with a single click. It’s like magic. But… with fork comes great responsibility… if you’re into forking and contributing and committing and pushing that is.
Another thing you can do with one click is to create a pull request. Usually you want to do this when you implemented a super duper feature or fixed a bug. Unfortunately, what you can’t do with one click is to link your pull request with an existing issue created on the upstream repo (i.e. repo you forked from), especially not if you’re working on a branch of your fork. The thing is: each time you create a pull request from GitHub website with a click, a new issue is created. Nasty. Of course I googled for solutions. People suggested using hub. I tried it, really, I did!, but referencing issue number in pull-request from the branch just didn’t work. All I got was this lousy
Error creating pull request: Unprocessable Entity (HTTP 422)
I tried referencing issue with its number, with full URL, using base (-b) and head (-h) parameter… nothing worked.
Wild guess: To be honest, what I didn’t try was merging my branch into forked master beforehand and then create the pull request with issue number. Will try next time I fix something, might take a while. :)
Long story short
I had to create pull-requests to GitHub repositories I’ve forked for some existing issues. I ended up creating pull requests with clicking and creating new issues. At least I figured out how to automatically reference an existing issue (from the new one).
The easiest way was to reference the issue in a commit message, e.g.
git commit -m "Fixed #xxx"
where xxx is issue number, obviously.
Words of wisdom after the git-battle: At the end I had two references to the issue, so be careful what you do in your branches before you push them to remote repository… It can get ugly! :) I just spent two hours figuring out how to remove one of the commits from remote repository history so it wouldn’t show up as a second reference to the issue, but no luck, just time lost.
Another wild guess: if you add some additional text to the commit message instead of just “Fixed #xxx”, new issue is created. Will definitely test it next time. Or you do it and tell me. Please… :)