How to contribute to an open source project
Tags: opensource, programming, github, git
Published: 2022-08-23 10:58:34

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">There is a world of advantages in contributing to open source projects. You improve the projects you love, enhance your skills, build a portfolio, have mentors, and learn people skills. However, you might still wonder exactly how to contribute to open source projects.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">While each project is unique and has its characteristics, the patterns are the same across different open source repositories. Knowing these similarities, we provide a guide to open source contributions.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1 id="h-what-you-need-to-contribute-to-open-source-projects"><strong>What you need to contribute to open source projects</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2 id="h-know-git-fundamentals"><strong>Know Git fundamentals</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">To contribute to open source projects, you need to have experience with version control because most projects are hosted on a version control repository, like GitHub, Bitbucket, and GitLab.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">As such, you need to understand the essential Git commands. GitHub provides a helpful <a href="https://education.github.com/git-cheat-sheet-education.pdf" target="_blank" rel="noreferrer noopener">Git cheat sheet</a> if you need to refresh your knowledge.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-understand-the-anatomy-of-the-project"><strong>Understand the anatomy of the project</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Understanding the code of an open source project is the most challenging task new contributors face. Beginners often try to understand the entire codebase at once, which will confuse you.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">A&nbsp; good open source project has rich documentation to help new joiners navigate the project. These files are usually at the top level of a repository:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>README.md - introduces the project, its purpose, and basic installation requirements;</li><li>CONTRIBUTING.md - gives clear instructions on how to contribute to the project;</li><li>ROADMAP.md - shares the vision for the project and the tasks that need to be done;</li><li>LICENSE.md - provides information on the reuse and permissions associated with the code;</li><li>Other documentation - tutorials, guides, or governance policies, depending on the project.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Although not all open source projects have CONTRIBUTING or ROADMAP files, having this documentation indicates <a href="https://blog.codacy.com/best-practices-to-manage-an-open-source-project/" target="_blank" rel="noreferrer noopener">how friendly and welcoming a project is</a>. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">After checking these files, try to understand the project structure: learn about file and folder hierarchy and their naming structure. Finally, take some time to understand the project's coding style and coding standards.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>Checklist before you contribute</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Here’s a handy checklist to evaluate whether a project is good for new contributors. Check the project and answer the following questions:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>[Basics] Does the project have an open source license? </li><li>[Basics] Does the project actively accept contributions?</li><li>[Commit activity] When was the latest commit?</li><li>[Commit activity] How many contributors does the project have?</li><li>[Commit activity] How often do people commit to the project?</li><li>[Issues] How many open issues are there?</li><li>[Issues] Do maintainers respond quickly to issues when they are opened?</li><li>[Issues] Is there active discussion on the issues?</li><li>[Issues] Are the issues recent?</li><li>[Issues] Are issues getting closed?</li><li>[Pull requests] How many open pull requests are there?</li><li>[Pull requests] Do maintainers respond quickly to pull requests when they are opened?</li><li>[Pull requests] Is there active discussion on the pull requests?</li><li>[Pull requests] Are the pull requests recent?</li><li>[Pull requests] How recently were any pull requests merged?</li><li>[Welcoming] Do maintainers thank people for their contributions?</li><li>[Welcoming] Are people friendly in the issues and discussion forum?</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":1} -->
<h1><strong>How to submit a contribution</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2><strong>Communicating effectively</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Working with others is one of the most critical skills you’ll develop in open source. So before you open an issue or pull request, keep these in mind:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Give context. If you’re running into an error, explain what you’re trying to do and how to reproduce it. If you’re suggesting a new idea, explain why it would be helpful to the project.</li><li>Do your research first. Before asking for help, check a project’s README, documentation, and issues (open or closed). People will appreciate it when you show that you’re trying to learn.</li><li>Keep requests short and direct. Every contribution requires someone else’s review. Many projects have more incoming requests than people available to help, so be concise. That way, you’ll increase the chance that someone will be able to help you.</li><li>Keep all communication public. Don’t contact maintainers privately unless you need to share sensitive information (e.g., security issues). More people can learn and benefit from your exchange when you keep the conversation public.</li><li>Ask questions, but be patient. Don’t forget that even longtime maintainers are not always familiar with every part of the project.</li><li>Respect community decisions. Your ideas may differ from the community’s priorities. As a result, they may offer feedback or decide not to pursue your idea.</li><li>Always assume good intentions. Open source has collaborators from all over the world, and sometimes context gets lost across languages, cultures, and backgrounds. Be patient, and remember that written communication makes it harder to pass a tone.</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2><strong>Finding and solving issues</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">In GitHub, every repository has an issues tab, where you can see current problems, bugs, and issues. If the repository is well-maintained, it will also have labels to help you filter the problems. Here are some tips for communicating on issues:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>If you see an open issue that you want to tackle, comment on the issue to let people know you’re on it. That way, people are less likely to duplicate your work.</li><li>If an issue was opened some time ago, it’s possible that it’s being addressed somewhere else or has already been resolved, so ask for confirmation before starting working.</li><li>When opening an issue, you should include steps to replicate. This helps developers identify the problem and start working on fixing it.</li><li>If you opened an issue but figured out the answer later, comment on the issue to let people know, and then close it.</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2><strong>Opening a pull request</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Now that you have solved an issue, it’s time to open a pull request. Project maintainers will view your changes, and your code will be merged into the base branch when approved. Here are some tips for when opening a pull request:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Run your changes against existing tests, and create new ones when needed.</li><li>Write commits according to the issue you solved.</li><li>Reference relevant issues or supporting documentation (for example, “closes issues #22”).</li><li>Include screenshots of the before and after (if applicable).</li><li>Contribute by following the coding style and standards of the project.</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":1} -->
<h1><strong>What happens after you submit a contribution</strong></h1>
<!-- /wp:heading -->

<!-- wp:heading -->
<h2><strong>You don’t get a response</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Did you check the project for signs of activity? Still, you might not get a response even on active projects. If you haven’t gotten a response in over a week, you can reply in the thread, asking someone for a review. If you still don’t get a reply, nobody may respond.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">There are many possible reasons you didn’t get a response, including personal circumstances that may be out of your control. Don’t get discouraged; try to find another project or way to contribute.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>Your contribution doesn’t get accepted</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Maintainers may not accept your contribution. You can ask the maintainer for feedback and clarification if you're unsure why. Ultimately, however, you’ll need to respect the decision. Don’t argue or get hostile, and thank maintainers when they put effort into helping you. In the end, you’re always welcome to fork and work on your version if you disagree with the decision.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>Someone requests changes to your contribution</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">It’s common for maintainers to ask you to make changes. If that happens, be responsive. After all, they’ve taken the time to review your code. On the other hand, if you don’t have time to work on the issue, let the maintainer know so they’re not expecting a reply, and someone else can take over.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>Your contribution gets accepted</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify">Congratulations, you did it! You’ve successfully made an open source contribution! So whether you just made your first open source contribution or it’s your 100th time, enjoy the moment.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":1} -->
<h1><strong>[Live Talk] Maintaining Code Quality in Open Source</strong></h1>
<!-- /wp:heading -->

<!-- wp:paragraph {"align":"justify"} -->
<p class="has-text-align-justify"><a href="https://youtu.be/-ltk8wpAMls" target="_blank" rel="noreferrer noopener">Watch here</a> <strong>Codacy CEO and co-founder Jaime Jorge</strong> in an exclusive live talk about code quality in open source, with <strong>Neils Lohmann</strong>, founder of the <a href="https://github.com/nlohmann/json" target="_blank" rel="noreferrer noopener">JSON for modern C++</a> on GitHub.</p>
<!-- /wp:paragraph -->