Contributing to Open Source for the first time

This month I took part in Github’s Hacktoberfest and contributed to open source projects for the first time! Hacktoberfest is a global event that takes place in the month of October motivating contributions towards open source projects. I guess I’d never done it before because I thought, I’m a first timer, where and how could I even contribute? These projects are so large and it seems like everyone knows exactly what’s going on. It usually went something like this:

  • Finds a cool project
  • Looks at issues
  • Right, right, cool, ok, maybe I shouldn’t mess with this issue. You know, all these issues have comments, seems like everyone is working on it already. Don’t want to mess anything up here. Let me check out another project.
  • Repeat process

I really wanted to contribute but felt unprepared and I’d loop through this thought process and never ended up contributing 😓

How I felt

Well, after doing some research I learned that there are many projects that give you the first time experience in the simplest of ways! If you’ve been wanting to contribute to open source but don’t know how, I hope that sharing my experience along with this step by step break down motivates and helps you when contributing for the first time. ⭐

️Finding a Project

There are many projects out there and lots of issues to be resolved, and as a first time contributor I really didn’t know where to begin.

Me looking at issues

I knew I wanted to contribute to a cool project, but needed some practice getting into the flow of things. Luckily I found a great Twitter page where I found some beginner friendly issues.

Making a contribution

I started with a very simple issue which was adding my name to a file. Not really an issue, but it was meant to be beginner friendly to get familiar with all the steps and creating a pull request. By my fifth open source contribution, I was writing documentation guidelines in Spanish. It’s like with any other task, the more you do it the more comfortable you get.

  • Once you find the project you want to work on and you’re on the Github page, you fork it. This is basically making a copy of the project for yourself.
Fork button is located on the top right of the page
  • Now you will see a copy of this project in your Github. What you want to do next is clone this project into your computer. You will see a ‘clone or download’ button and it will show you a link and little clipboard button next to it. Click on the clipboard button, it will copy the link:
Note the link has your username
  • Now go into your terminal and redirect wherever you want this project to live and clone it using the command : git clone paste_your_link . An example: git clone https://github.com/your_username/name_of_repo
  • You can do the command ls and see that the project you just cloned is now listed. Next, you want to direct into the project you just cloned using the command: cd name_of_project_cloned.
  • Create a branch so you can start making changes using the command: git checkout -b name_of_branch . This creates a branch and redirects you into the branch too. An example: git checkout -b add_problem. Now I have a branch called ‘add_problem’ and I’ve gone into that branch.

Now you can go ahead and make the changes you want to! All the changes you make will live in your branch, so don’t worry, you aren’t actually making changes to the original project just yet. Once you’ve made all the changes you want, you can commit these changes to your local repository (your computer) and then push them to Github (your copy of the project).

  • It’s time to save those changes. Go to your terminal, you can see all the changes you’ve made with the command git status . Use git add . to stage all of these changes. If you do git status again, you will see that your change/changes are now the color green! Now you have to commit the changes to your local repository, and write a good short description of the changes you made. The command is git commit -m 'a description of your changes' . An example: git commit -m 'added new python practice problem' In this command you need those parentheses surrounding your description.
  • Now to push these changes into your Github. Use the command: git push and it will prompt a line that looks something like git push --set-upstream origin name_of_branch . Copy this line, paste it into your terminal and enter. You just pushed your changes into your Github! In the future when you make new changes to this same branch and you want to push them into your Github again, simply use git push and it will know that it means push these changes into Github.
  • When you go into your Github, you will now see that there’s a highlighted line at the top with a green button that says ‘compare & pull request’.
The name of your branch will appear on the left and the green button is on the right. In this example I had a branch called ‘add_problem’
  • Time to make a pull request! Click on the green button and you will see a bar comparing your change to the original repository, and a place to write a small description of what you did.
‘base fork’ is the original repository ‘head fork’ is your copy. You are comparing the master with your branch
  • Now click that ‘create pull request’ button and you did it! You will see a page that shows the pull request you just submitted 🐛
Branch has no conflicts and is waiting to be reviewed and accepted by original repository owner

Great! Now the original repository owner will review the changes and either merge those changes to the original repository or will connect with you on further changes that need to be done before merging. Once your changes have been merged, it’s good practice to delete the branch you were working with, in my example add_problem , and create a fresh branch if you want to tackle a new issue. Go to your terminal and type git branch to see your branches. You can’t be on the branch you‘re about to delete, so you can switch to your master branch. To switch branches use git checkout name_of_branch . So it looks like git checkout master . Now that you aren’t on the branch you plan on deleting, you use the command git branch -D name_of_branch_to_delete . An example: git branch -D add_problem . Now if you do git branch again, you will see that branch is gone. You can follow these same steps to create a new branch and make more pull requests!

We contributed to open source!

Resources

I’m providing links to articles that helped me while contributing and that also helped me when I ran into any issues! The thing to remember is not to panic or feel intimidated. It’s a rewarding experience and you are completely capable of making great contributions!

Guides

Beginner Friendly Projects