How to Make Your First Open Source Contribution

Last week I made my first open source contribution, and you can too. I had been interested in helping with open source for a long time, and wanted to make a contribution, but I was never sure where to start. This post will explain how I made my first open source contribution, and I will try to provide steps that you can follow so that you can contribute too.

The steps I followed are, basically:

  1. Find a project with issues you can contribute to.
  2. Pick an issue to try to tackle. If possible, contact the maintainers to make sure it’s still a thing and needs help.
  3. Follow their steps for local setup and testing. Make sure master runs all tests locally.
  4. Fork the repo, and track the fork; write the appropriate code and tests; push this work to your fork, and open a PR.

Step 1: Find a project with issues you can contribute to

Diesel’s issue backlog is extremely helpful. I can filter by whether something is easy for newcomers, whether help is wanted with the issue, and whether someone is already working on it. And because GitHub is awesome, this search makes a bookmarkable URL: unassigned, help-wanted, easy for newcomer issues on diesel. Because of this capability, I could be confident that I’d figure out what to work on to improve diesel. I also read through some of the issues to make sure they seemed like something I could tackle.

Step 2: Pick an Issue

Equipped with the query above, I decided to pick an issue. I picked using associated constants because it seemed very small and well-defined. It also seemed like the sort of issue where, if I broke the code, nothing would compile, which is great for newcomer issues, because it means that once I have the build and tests working locally I can be very confident in my work. Note that I commented on the issue to make sure that it was actually available. The maintainers got back to me immediately (another good sign), so I decided to get to work.

Step 3: Follow Their Steps to get Local Dev set up

Diesel has good “getting started” steps, which is a big help. The only hiccup was getting MySQL set up locally, just because I’ve almost never used MySQL, and it took me a minute to figure out how to let MySQL in a container work with diesel. (I needed the mysql c client library on my host and to change the permissions in the database.)

The reason I say “Follow Their Steps” is twofold: First, because you likely won’t think of everything necessary to work on a particular codebase, and you don’t want to ask the maintainers questions that would have been answered by reading the docs. Second, because it tests their steps. For example, when I was working on diesel, I discovered that the script they advise people to run locally lints all the test code, while their CI build does not lint test code. This information is helpful to the maintainers.

Step 4 is the actually writing code part, but after steps 1-3, I found that this is a lot like writing code at work, and I’m not going to elaborate it much here.

In summary: Contributing to open source can sound intimidating, but I think the steps above will help you perform simple, concrete steps that will take you closer to the first pull request. I hope this helps.

Till next time, happy learning!

-Will

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s