A Beginner's Guide to Open Source Contributions on GitHub
Tags: tutorial, beginners, github, opensource
Published: 2024-07-02 23:06:42

## Contents

- [Introduction](#introduction)
- [Preparation](#preparation)
- [Ways to Contribute](#ways-to-contribute)
	- [Raise an issue or make a suggestion](#raise-an-issue-or-make-a-suggestion)
	- [Reproduce a reported bug](#reproduce-a-reported-bug)
	- [Test a pull request](#test-a-pull-request)
	- [Solve a reported bug](#solve-a-reported-bug)
- [General Guide](#general-guide)
- [Summary](#summary)
- [Resources](#resources)

## Introduction

Being a developer isn’t all about creating cool solo projects. Some of the best repositories out there are **open source**, meaning they are maintained and updated by other developers over time. Maybe you have heard of some of these: VS Code, Git, React, TensorFlow, Django, etc. These repositories have reached their status because developers come together to fix common bugs and issues.

As a developer, it is crucial to know how to contribute to open source projects on GitHub. Not only does it reinforce our problem-solving skills, but it also allows aspiring developers to be a part of something greater. This blog will introduce how to make contributions to most open source projects on GitHub.

## Preparation

Before diving into making changes to any codebase, we must first select the appropriate repo. Selecting a repo as a first-time contributor can be daunting. For those absolute beginners, we could start with the [first contributions](https://github.com/firstcontributions/first-contributions#first-contributions) tutorial. This repo provides step-by-step instructions on how to make your first contribution.

Once you feel a bit more comfortable, we can look for real repos. There are some resources to help you find that right repo. They are listed here:

- [goodfirstissues.com](https://goodfirstissues.com/)
- [goodfirstissue.dev](https://goodfirstissue.dev/)
- [up-for-grabs.net](https://up-for-grabs.net/#/)
- [Code 52](https://github.com/code52?WT.mc_id=-blog-scottha)

More advanced folks may want to try different types of projects. A good starting point could be in (GitHub’s Explore)[https://github.com/explore]. Once you have found a repo you are interested in, we can dive into different ways to contribute.

## Ways to Contribute

There are many ways to contribute to an open source repo. I will cover the most common ways here, listed in increasing order of difficulty.

### Raise an issue or make a suggestion

One of the easiest ways to contribute to an open source project is by raising an issue or making a suggestion. By identifying and documenting a problem or improvement idea in the project’s issue tracker, you help maintainers prioritize and address issues efficiently. When raising an issue, make sure to provide clear and detailed steps to reproduce the problem, along with any relevant context or error messages encountered. Similarly, when making a suggestion for improvement, articulate your rationale and propose practical solutions or enhancements that align with the project’s goals.

### Reproduce a reported bug

When encountering a reported bug in an open source project, your ability to replicate the issue is crucial for developers to understand and resolve it effectively. Begin by following any steps or instructions provided in the bug report to reproduce the issue on your own system. This process involves documenting the exact steps taken, any specific configurations or environments required, and noting any error messages or unexpected behaviors encountered. By accurately reproducing the bug and providing detailed feedback, you assist developers in pinpointing the root cause and implementing a targeted fix.

### Test a pull request

As developers propose changes to an open source project, they submit pull requests for review and integration. Testing a pull request involves evaluating the proposed changes to ensure they function as intended and do not introduce new issues or regressions. Begin by understanding the scope and purpose of the pull request, reviewing the associated code changes, and considering potential edge cases or scenarios not covered in the initial implementation. Execute relevant test cases, perform integration testing if applicable, and validate the overall impact of the changes on the project’s functionality and performance.

### Solve a reported bug

Addressing a reported bug in an open source project involves identifying the root cause of the issue, proposing a solution, and implementing the necessary code changes to resolve it. Begin by analyzing the bug report, reproducing the issue if necessary, and investigating related code areas to understand the underlying cause. Once the problem is identified, devise a strategy to fix it while adhering to project coding standards and practices, typically found in Contributions.md. Implement the solution by modifying the codebase, writing new tests if applicable, and ensuring compatibility with existing functionalities. Collaborate with project maintainers and contributors to review the proposed fix, incorporate feedback, and verify the resolution through thorough testing.

## General Guide

For all types of contributions, it is best practice, especially as a beginner, to be able to isolate any changes before submitting a change. Here are the basic steps:

1. **Fork Repo**: Once you have found a repo to work on, fork to create a copy of the repo to your GitHub. This can be done by clicking the fork button on the top of the repo home page.
2. **Clone Repo**: Clone a copy of this to your local computer. This is done by going to a command line interface (such as Terminal on Mac) and running `git clone <SSH>`. The `<SSH>` can be found by clicking on code on your forked repo.
3. **Create New Branch**: Create a new branch and switch to it for your specific contribution using `git switch -c <name-of-new-branch>`.
	- **Raise an issue or make a suggestion**: This step may not be necessary if you’re simply raising an issue or making a suggestion without code changes.
	- **Reproduce a reported bug**: Use this branch to document your steps and any finding while reproducing the bug
	- **Test a pull request**: Use this branch to fetch and test the changes from the pull request.
	- **Solve a reported bug**: Use this branch to develop your bug fix.
4. **Make Changes and Test**: Depending on the type of contribution:
	- **Reproduce a reported bug**: Follow steps provided in the bug report and document findings.
	- **Test a pull request**: Run the relevant tests and verify the changes.
	- **Solve a reported bug**: Implement your fix and test it thoroughly to ensure it works as intended.
5. **Commit Changes**: Add and commit the changes for submission. This is done by running `git add .` followed by `git commit -m “enter commit message here”`.
6. **Push Changes**: Run `git push` to finalize the save into GitHub.
7. **Create a Pull Request**: Navigate to “Pull Requests” on your forked repo and click on “New pull request”. Provide a concise explanation of your changes and how they address the chosen issue. If needed, reference the issue number in the description.

Once submitted, project maintainers will review the pull request.

And that’s it. You have now completed your first open source contribution!

## Summary

Contributing to open source projects is a rewarding way to improve your skills, collaborate with other developers, and make a meaningful impact on software used by people worldwide. Whether you start by raising an issue, testing a pull request, or solving a bug, every contribution helps strengthen the project and its community. By following the steps outlined in this guide, you’ll be well on your way to making your first open source contribution. Happy coding!

> This guide is meant to serve as a learning tool for people who are just starting to learn how to make open source contributions. Please read the official documentation linked below for more information. Thank you for reading and if you have any questions or concerns about some of the material mentioned in this guide, please do not hesitate to contact me at jjpark987@gmail.com.

## Resources

- [GitHub’s Getting Started](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
- [Blog: Get involved in Open Source today - How to contribute a patch to a GitHub hosted Open Source project like Code 52](https://www.hanselman.com/blog/get-involved-in-open-source-today-how-to-contribute-a-patch-to-a-github-hosted-open-source-project-like-code-52)
- [first contributions](https://github.com/firstcontributions/first-contributions#first-contributions)
- [goodfirstissues.com](https://goodfirstissues.com/)
- [goodfirstissue.dev](https://goodfirstissue.dev/)
- [up-for-grabs.net](https://up-for-grabs.net/#/)
- [Code 52](https://github.com/code52?WT.mc_id=-blog-scottha)