First timers’ Practical Guide to Open Source Contribution
A beginner's guide to open source and how to make contributions on GitHub.
6 min read
Table of contents
- What is Open Source?
- A general approach to open source contribution
- Practical steps to take before making any open source contribution
- A step-by-step guide to open-source contribution
- 1. Fork the repository
- 2. Clone the repository
- 3. Change to the repository directory
- 4. Synchronize and reference your local repository to the remote repository
- 5. Create and switch to a new branch
- 6. Open the project folder in a Code Editor
- 7. Stage all files to Git
- 8. Commit changes to Git
- 9. Push the new branch to the remote repository
- 10. Submit a pull request for review
- No-code open-source contribution
The source code for open-source software or projects is made public, allowing anyone to understand how the program works. You can also modify it, by fixing the issue(s) or bug(s) you noticed, proposing new features, or even interacting with the developers or maintainers.
This overview highlights a thorough, easy-to-understand guide to making open-source contributions as a beginner. Let’s dive in!
What is Open Source?
Open source implies that it is freely and publicly available for anyone to use, inspect, modify, or enhance.
As a first-timer, you might get confused about how to make your first open-source contribution. I'm sure you will find a way out after going through this article. Without further ado, let's get started!
A general approach to open source contribution
Find open source projects on GitHub: Search for open source projects built with your preferred programming language.
Pick an open issue: Choose an issue with first-timer, or beginner-friendly. If you are interested in fixing the issue, add a comment stating you would be working on it.
Work on the issue: Go through the CONTRIBUTING.md file to know how to contribute.
Submit your pull request: Make sure you follow the conventions stated in the CONTRIBUTING.md file while submitting a pull request (PR). Add a good commit message too.
Wait for feedback: The open source maintainer(s) will review the PR or suggest changes if there’s a need before it’s merged.
Practical steps to take before making any open source contribution
Find a project you would like to contribute to.
Go through the README file.
Read the Code of Conduct.
Read the Contributing Guideline.
Read the Development and setup instructions.
Indicate you are will work on an issue by commenting.
Fork and clone the project into your computer locally.
Submit a Pull Request.
Wait for the Pull Request to be reviewed and/or merged.
A step-by-step guide to open-source contribution
There are two basic ways of contributing to open source;
a. Create your project publicly: This involves starting your project and hosting it on GitHub.
b. Contribute to existing open-source projects
Before participating in open source, you should understand the project, its codebase, and the use of Git and Markdown. Check out Learn Git Branching for an interactive lesson on Git.
Let's look at the guidelines for downloading the project locally, making changes, and then publishing them online for review:
1. Fork the repository
By forking a repository, you have a copy of the project. Now, you can edit and submit your own updated copy through a pull request, to be included in the main project.
2. Clone the repository
Once, the repository is forked on your own GitHub profile, the next step is to download it to your computer. To clone a repository, copy the HTTPS or SSH URL
In your GitBash or terminal, run the command, which should look like this:
git clone https://github.com/<your-username>/project-name.git
Note: Install Git on your computer and connect your GitHub account to it, if you haven't already.
3. Change to the repository directory
Navigate to the project folder using the command below:
4. Synchronize and reference your local repository to the remote repository
Add the main project repository upstream to your already cloned local project files by running the following command on your terminal:
git remote add upstream https://github.com/<Project-owner>/project-name.git
Check if your cloned repository syncs with the remote repository.
git remote -v
You can easily pull any changes from the remote repository to your computer by entering the command:
5. Create and switch to a new branch
Creating a new branch gives you room to make any changes, or experiment with the project without affecting the main branch.
git checkout -b branch-name
6. Open the project folder in a Code Editor
Locate the repository folder on your computer, and open it or drag and drop it into your favorite code editor. Then, make the necessary changes, fix an issue, or add new features.
Confirm the state of the current branch and all modified files with the command:
Note: Changed file names should appear in red while unchanged files appear in green.
7. Stage all files to Git
Apply all changes and add all the files to the git tracking list. Enter the command in your terminal:
git add .
8. Commit changes to Git
Now, you should commit all the changes to your branch. The command below commits the changes with a unique hash on Git:
git commit -m"describe the changes made"
Note: Writing a concise commit message in the active voice is recommended.
9. Push the new branch to the remote repository
In this step, publish your branch and the file changes to GitHub. In your terminal, enter the command:
git push origin branch-name
10. Submit a pull request for review
Go to the forked repository on GitHub, where you can see all of your file changes and a "Compare and Pull Request" button. Click it to open a pull request from your featured branch to the project repository's main branch.
Add the appropriate title and description to your pull request. Once, it is reviewed, your pull request will be merged by the project maintainer.
Congratulations! You just contributed to open source.
Do you want to gain first-hand experience? Check out the following GitHub repositories:
No-code open-source contribution
A common misconception is that learning to code or becoming a developer is required before working with open source. Fortunately, most contributions are "code-free."
Let's look at some non-coding approaches to open source. Below are ways to contribute to Free and Open Source Software (FOSS) without knowledge of programming or code:
Submit Bug reports by opening new issues.
Ask questions by getting involved in the project discussions.
Answer others' questions or provide feedback.
Write a blog post about an open-source project or open-source in general.
Become an advocate or evangelist of open source project(s).
Write tests for FOSS projects.
Help with design and UX research.
Sponsor, donate, or provide any financial support for the open-source project you use.
Improve the documentation of open-source projects on GitHub.
Contributing to open source may seem quite daunting as a first-timer, but you will get familiar with the process through continuous practice. As a recap, there are many ways to make open-source contributions other than just code, such as by opening issues, updating the documentation, or suggesting new changes.