This is my first blog post in 9 months! During my absence from blogging, I’ve managed to survive being a new dad (of a now 8- month old daughter), navigating nannies and child care as well as child-proofing our home. I am finally coming out of “survival mode” and looking to get started again.
I’m going to try to shake out the cobwebs and talk about my latest experience as a developer; finding and contributing to my first open source project on GitHub.
I Want to Contribute, but I Have No Idea Where To Start!
While attending NSBCon 2015 last year in Texas I met a developer named Dave Rael who hosts a great podcast called Developer on Fire. I had also had a chance to catch Daniel Marbach‘s excellent presentation on the upcoming NServiceBus 6.0 beta release. After the conference, Dave had Daniel on this podcast, and I listened to the episode. In the episode, Daniel talked about getting involved in open source, and how, at night, for a couple hours, he’ll do open source work.
Being motivated by his podcast to find a repository on GitHub I could contribute to, I reached out to Daniel via Twitter and asked him how he found projects he was interested in contributing to. He wrote me back and said he usually worked on friend’s repositories, but I should check out Up For Grabs. Up For Grabs is a site that aggregates GitHub repositories that have Issues labeled “jump-in”, “up-for-grabs”, “help-wanted”, etc… basically, projects looking for help.
Daniel recommended that I look for a project that would teach me a new skill/framework/language, etc… Since C#6 was pretty much on the horizon at that point, I tried to find a project that needed help upgrading their code to C#6…
The only problem was, I had no idea how to use Git or GitHub.
TFS and Cold Feet
I’ve had a GitHub account for awhile now, and had done some small commits to my own repositories, but overall, I had only worked with more than one developer using a centralized source code system like Team Foundation Server. If you’re in this camp, let me just say it is in your best interest to learn a distributed source control system like Git (there is a reason TFS/Visual Studio 2013-2015 has made Git a first-class citizen).
Visual Studio 2015 makes it very easy for “TFS’ers” to work with local Git repositories without ever leaving the comfort of the IDE. For those of you with PluralSite subscriptions, I found Git for Visual Studio Developers a great place to start.
Even if you don’t know what you’re doing, most GitHub repository owners will be more than glad to help you coordinate your first PR. It’s in the repository owners best interest to help because their repository will benefit from the contribution, especially if the contributor wants to make more than one contribution and get more involved in their project.
My First Contribution: The “Validator” Project
To get my feet wet, I tried to pick a repository that did not have much traffic as far as commits are concerned and had a very simple code base. I wanted to avoid more complex scenarios like merging and rebasing, and instead stay focused on learning C#6 as well as trying to figure out how to work with GitHub. My search led me to the “Validator” project:
The Validator project is a port of the validator.js GitHub repository to C#. The concepts were simple, so I forked the repository and then pulled a local copy down to my machine. After familiarizing myself with the code I reached out to the project owner and asked if I could take a crack at submitting a PR against the repository for upgrading it to C#6:
Just from my first message, I already learned something: you can use “@” to direct a message at someone on GitHub, cool!
After I was done the C#6 upgrade on my local project, I submitted by first PR:
The project owner got back to me on my PR by commenting on my code inline on GitHub with some corrections:
an some encouragement:
After iterating on the corrections and a couple PR’s later, all my changes were officially accepted to the Validator project and the Issue was closed:
tip: if you automatically want the Issue your PR if tied to to close automatically once the PR has been merged, in the Issue, use the word “Fixes #[IssueNumber]”. This makes it much easier on the project owners doing the merge because they don’t have to manually track down the Issue(s) the PR was for, and close them by hand.
It felt really good to finally contribute some code to an open source project. Not only was it cool to learn to use GitHub, but what was even a better feeling was one of collaboration which GitHub makes brain-dead simple with its excellent workflow around Issues, PR’s and feedback. Also, I learned a lot of new C#6 syntax, which has readied me for our move to C#6 at my day job.
In the end, I upgraded the project to use C#6 syntax, learned how to submit a PR and use GitHub. I was still a GitHub “newbie”, but now felt confident enough to start looking for another open source project which would be more involved and could also be a learning experience for me.
I’ll be covering that in my next post…