Open Source on Github: Your First Contribution (Repost)

August 22nd, 2013 by JasonLe's Tech Leave a reply »

As a senior Computer Science student, I am constantly hearing about how great it is to contribute to open source projects on github. Many job listings list it as a qualification or a “plus”, and it is casually thrown around in conversation at all kinds of seminars and events at school. Sounds great, I should do that! The only problem is: I’m a huge noob! I’ve done well in my computer science classes at school, sure, and I’ve built some projects that my family and friends think are cool, yes, but surely I can’t contribute in any meaningful way to a project with real users, right? Right?

Wrong!! There are a variety of different ways to make substantive contributions to open source projects on github, even as a total rookie. You don’t have to be able to read and understand all 100,000 lines of rails or know how to fix that issue with the dynamically stacking grid in bootstrap to be able to do something meaningful that affects real users. There are ways for everyone to contribute.

I recently made my first real contribution to an open source project, and as small as it was, I got a refreshing sense of accomplishment knowing that there were people out there using something that I had written a tiny part of. You have to start small and work your way up. Here is my advice to anyone who wants to contribute to an open source project on github, but has just felt overwhelmed trying:

The first step is to find a repository that is looking for pull requests. You can find these in a couple ways. The simplest way is to just read through the readme file. It will often explicitly state that the owner of the repository is eagerly accepting pull requests. If the readme doesn’t say anything about pull requests, you can look at the issues and pull requests for the repository. By checking the dates of the pull requests, and looking through the pull requests that have been closed, you are able to judge how likely it is that the owner of the repository is actively updating it. Bonus points if you can find a project that truly interests you and meets the above qualifications. In my case, I found a rails template for creating new projects where the readme file stated on the first line, in bold: Pull requests are welcome. Nice!

Now, it’s time to fork and clone the repo. Here is a good guide if you don’t know how to do this.

Follow any instructions in the readme and make sure that you can configure and run the project on your local system. If you encounter any issues not discussed in the readme, or any errors, this is a great first contribution! You can edit the readme to make it clearer for other contributers who follow you. One of the best ways to start contributing to projects is to make them easier to work with. You can cleanup the readme, edit mistakes in the documentation, or clarify either. It’s a bit intimidating to jump into someone else’s codebase and start making changes right off the bat. These are non-threatening ways to start your open source career. The repository I wanted to work on was well documented and simple enough that there wasn’t anything to help with here.

If you still haven’t found a way to contribute yet, read through all the issues in the project. These are suggestions for additions or modifications, sometimes proposed with pseudo code or even a start to the code by someone who just didn’t have the time to finish the fix. You may be able to find something that has been worked on and wouldn’t require dramatic code changes to implement.

If you don’t think you can help out with any of the errors, the repo owner may have included a todo section in the readme file, or you may have your own ideas. In my case, I was tired of browsing repositories (even my own sometimes) and seeing .DS_Store being added to them on github. .DS_Store gets added to a project when it is viewed in the Finder in OSX, and there’s no reason to push it up to github. I could add it to the .gitignore for the rails template, which would ensure that nobody using the template would accidentally include it in their push. I had my contribution! Now I just had to implement it, which was exceedingly simple. Make sure you follow all the conventions that exist in the project. It is important to look at other pull requests and the readme to see the owner’s preferred format, and to make sure you use the commit message that he or she wants. I followed the above guide to submitting a pull request, added the code:

# DS_Store gets added to project if viewed in OSX Finder
 run "echo '.DS_Store' >> .gitignore"

And an hour later my pull request was merged into a real project that a couple hundred people have starred on github. I felt a renewed sense of purpose to my work. People were using something I had written a (small) part of!

What has been missing in my experience as a CS undergrad is a sense of tangible accomplishment — that is, I want to know that what I am doing matters. I have learned algorithms, data structures, a couple programming languages, and coded endlessly. I know my stuff pretty well. But what I haven’t had a sense for is my work affecting anyone. I am always left thinking “Why does this matter? Who is this affecting?” At the end of the day, I want to know that my work matters to someone.

Although it may be intimidating, and certainly has a steep learning curve, contributing to open source projects on github is a great way to achieve that sense of satisfaction.