Many aspiring developers wish to start contributing to open source but they lack a starting point.
Why is contributing to open source important?
Contributing to open source is a way to practice your coding skills as well as a chance to work on real life problems and colalborate with others
In this article, we will go through the steps one can take to contribute to a simple first project.
Some knowledge of Git and GitHub is required.
You can get a refresher by reading my article on Git basics here.
1. Look for a good first issue
For our first issue, we will use the first contributions GitHub repository that is specifically built for beginners to practice contributing to open source.
2. Fork the repository
Click on the fork repository button in the screen below.
This will create a copy of the repository in your GitHub account that you can then work with
3. Clone the repository to your local computer
To have a local copy of the first-contributions repo, run the command git clone https://github.com/firstcontributions/first-contributions.git
in the appropriate local folder.
You can copy the link to the repository when when you click on 'code' then 'Copy' on the screen below
4. Create a branch
We now have a copy of the code in our local computer.
Navigate to that directory so that we can make the necessary modifications.
We will create a branch from our master branch so that we can work on changes to our code. It is this branch that will push to GitHub, create a pull request and hope its merged to the main branch.
Let's call our branch 'add_my_name'
To create the branch and check it out at the same time, we run the command git checkout -b add_my_name
.
This will create the branch and set it as our current working branch.
5. Make the required changes
For this repository, the extent of changes we can make is editing the 'Contributors.md' file to insert our name.
Open the Contributors.md file and add your name to the file and save it.
Remember we are working on the branch add_my_name
. Time to submit our changes
6. Push local changes to GitHub
Run the command git push -u add_my_name
. This will sync our local and remote repositories
7. Create pull request
Go to your GitHub page and if you've done everything right, you should see a page with a 'Compare Pull request' button like below. Click it
Click on the 'Create pull request' button as below
A pull request is a notification to the owners of the code that you've made some changes to their code and you'd like them to merge them into their projects
At this point you'll see the following page
And its at this stage where you'll celebrate having done your first contribution to an open source project. Congratulations!!
The purpose of this simple project is to expose you to the tools and the typical workflow of a simple open source contribution.
In subsequent articles, we will get more familiar with the fork-clone-Edit-PR cycle that is typical in any open source contribution workflow.
Adios.
Top comments (0)