DEV Community

Rafael E. Poveda
Rafael E. Poveda

Posted on

Contributing to open source...

Contributing to open source is one of the things that I love to do the most. It's a nice feeling being able to contribute to a project that is helping other developers and having the change to work with people from who you can learn is always appreciated.

I opened a Github issue in a library that I used in my previous work and I would love to show you the process of how I fix it by contributing with code and maybe hopefully motive you to make your own contributions to this or other projects.

The project is react-dynamic-swiper which is a React wrapper around the awesome iDangerous swiper library.

Identifying an issue

There are two ways in which you can find issues to start fixing.

1) You found an issue in a library that you are using and notice that it hasn't been reported by anybody else.

2) You can find open issues with labels like help wanted or low hanging fruit in projects even thou you haven't experienced the issue by yourself. This page can help you to find issues.

In the case of react-dynamic-swipper I notice that it had a missing feature so I open an issue asking the author if it was a mistake or if the feature wasn't include in the library's road map.

It's important to try to find is the issue was already reported or if somebody else is working on the solution. It's super frustrating when you spent time working on a solution and finding out that the somebody else published one first or even worst that the issue never existed on the first place.

https://github.com/nickpisacane/react-dynamic-swiper/issues/25#issue-429471387

After a few days, the author confirmed that this was effectively a missing feature and if I want it I can make a pull request to solve the problem.

Preparing the stage

Now that the issue is assign to you, you can start working on it. The first step is making a fork of the project.

To make a fork you should use the Fork button that is located in the project's github page.

Github fork button

When you click on the fork button, Github will take you to the same project but under your username. And now you can clone it into your machine.

Go to your recently created project, create a new branch and now you are ready to make the changes in the code.

Do the actual change

This part is the most difficult to explain because is different in each case. The change could be a typo in the documentation (this kind of changes are very important for project maintainers), could be adding a new feature o even a complete rewrite.

I can't help you too much on this step but I can give you some advices that are transversal to every type of contribution.

  • Try at your best of making the change following the project's contribution guidelines. If the project doesn't have one you can contribute by adding it.

  • When you have a proposal even if it is not finished open a PR indicating that you need a maintainer's opinion.

  • Be open to criticism and please don't take other people comments in a personal way. If they ask for modifications take them in consideration. Changes are, they know the project better than you so take that as an opportunity to learn about the project.

This is the change that I proposed for this library.

Make the Pull request a wait for it to be included

This part could be fast or could take a long time depending on the project. Sometimes your PR cannot be include it at all because it's not something the maintainer agrees with (this sucks, i know :().

Please be patient and avoid making comments to rush the maintainer to merge your change.

Profit

Once your contribution is include it you are now part of the project and can be proud that you help to build something that other people use.

What's next?

Contributing to open source is an excellent way to improve your skills and helping people at the same time. A lot of people are able to get awesome jobs by dedicating time improving open source libraries.

Also, once you start doing it you always feel the need to do it more often so it is a win-win situation.

If you want to go deeper on how to contribute to open source projects there are awesome resources to start with:

https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project
https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github

Discussion (0)