- Buy Microsoft Visio Professional or Microsoft Project Professional 2024 for just $80
- Get Microsoft Office Pro and Windows 11 Pro for 87% off with this bundle
- Buy or gift a Babbel subscription for 78% off to learn a new language - new low price
- Join BJ's Wholesale Club for just $20 right now to save on holiday shopping
- This $28 'magic arm' makes taking pictures so much easier (and it's only $20 for Black Friday)
How to Contribute to Open Source and Why
Getting involved in the open-source community (especially early in your career) is a smart move for many reasons. When you help others, you almost always get help in return. You can make connections that can last your entire career, helping you down the road in ways you can’t anticipate.
In this article, we’ll cover more about why you should consider contributing to open source, and how to get started.
Why Should I Get Involved in Open Source?
Designing, building, deploying, and maintaining software is, believe it or not, a social activity. Our tech careers place us in a network of bright and empathetic professionals, and being in that network is part of what brings job satisfaction and career opportunities.
Nowhere in tech is this more apparent than in the world of free and open-source software (FOSS). In FOSS, we build in public, so our contributions are highly visible and done together with like-minded developers who enjoy helping others. And by contributing to the supply of well-maintained open-source software, we make the benefits of technology accessible around the world.
Where Should I Contribute?
If you’re looking to get started, then the first question you’re likely asking is: Where should I get started? A great starting place is an open-source project that you have used or are interested in.
Most open-source projects store their code in a repository on GitHub or GitLab. This is the place where you can find out what the project’s needs are, who the project maintainers are, and how you can contribute. Because of the collaborative and generous culture of FOSS, maintainers are often receptive to unsolicited offers of help. Often, you can simply reach out to a maintainer and offer to contribute.
For example, are you interested in contributing to Django? They make it very clear: We need your help to make Django as good as it can possibly be.
Finding known issues
Most projects keep a list of known issues. You can find a task that fits your knowledge and experience level. For example, the list of issues for Flask shows the following:
Finding tasks for new contributors
Finally, many maintainers take the time to mark specific issues as being better for new contributors. For example, the Electron project applies a “good first issue” label. Notice the “Labels” selector on GitHub. You can use this to filter, showing you the best issues to start with.
Now you’ve got an issue to work on. How should you get started?
The Contribution Process
The basic process for contributing to open source is fairly uniform across all projects. However, you should still read the contributor guidelines for an individual project to be aware of any special requirements.
In general, the process looks like this:
- Fork the project repository
- Solve the issue
- Submit a pull request
- Wait for feedback
Let’s examine each of these steps in detail. We’ll use GitHub for our examples; most online repositories will operate similarly.
Fork the Project Repository
When you fork a project repository, you create a local copy of the project to do your work on. After you have your own copy, be sure to read any special instructions in the project README so that you can get the project up and running on your machine.
In GitHub, you can simply use the “Fork” button to start this. You’ll find it in the upper-right part of your screen:
As you save the forked repository to your account, you’ll be prompted to provide a name for it.
Solve the Issue
With a forked local copy up and running, you’re now ready to tackle the issue at hand. As you solve the issue, it’s important to keep a few things in mind:
- Pay attention to any coding style guidelines provided for the project.
- Make sure the project will run as expected, and that any provided tests pass.
- Comment your code as needed to help future developers.
Now that you’ve got a solution in place, it’s time to present your solution to the project maintainers.
Submit a Pull Request
The maintainers of the project need to review your proposed changes before they (hopefully) merge those changes into the main project repository. You kick off this process by submitting a pull request (PR).
Open a new PR
You can start PR creation in GitHub right from the original repository by clicking on New pull request on the Pull requests page.
Set up the branch comparison
On the Compare changes page, click on compare across forks.
Choose the branch to merge
When creating a pull request, it’s very important to pay close attention to which branch you want to merge.
The branch in the original repository
First, select the desired branch that the code changes will merge into. Typically this will be the main branch in the original repository, but be sure to check the contributor guidelines.
The branch in your forked repo
Next, select the branch from your forked repository where you did the work.
Give your PR a title and description
Next, you’ll need to provide a title and description for your pull request. Don’t be overly wordy. You can explain your approach, but you should let your code and comments speak for themselves. Maintainers are often tight on time. Make your PR easy to read and review.
Some repositories provide template content for the PR description, and they include a checklist of items to ensure all contributors adhere to their process and format. Pay attention to any special instructions you’ve been given.
Create the pull request
After making sure you’ve provided everything the maintainers are asking for, click Create Pull Request.
You’ve done it! You have submitted your first PR for an open-source project!
Wait for Feedback
You’re likely anxious to hear back on your PR. Again, check the contributor guidelines for what to expect here. Often, it will be some time until you hear back, and maintainers may not want you to nudge them.
If there are any points to address in your PR, maintainers will probably have that conversation with you as a thread in the PR. Watch your email for notifications. Try to respond quickly to comments on your PR. Maintainers appreciate this.
If you need to refactor your code, do so, and then commit the changes. You likely will not need to notify the maintainer, but you should check the contributor guidelines to be sure. The platform (in our case, GitHub) will notify the maintainers of the commit, so they’ll know to look at the PR again.
Conclusion
Your first time contributing to open source can seem daunting, but you don’t need to hesitate. The culture in the FOSS community is typically inviting and inclusive. If you’re strategic about how you get started, then you’ll quickly rack up a good record of contributions. Along the way, you’ll become a better engineer, have a chance to make the projects you love even better, and form relationships that can last throughout your career.
To see how we’re contributing to open source projects, visit us at KubeCon 2022.
Learn more about GitHub in our Learning Lab: Hands-on with Git and GitHub.
Share: