The Road to the first PR in GSSoC

Sukriti Shah
GirlScript Summer of Code
4 min readJun 5, 2020

If you are someone who wants to make their first PR to an open-source project then this blog will help you get started.

Hola!

So, I got selected in GirlScript Summer of Code (GSSoC’20) in February and the coding period commenced on March 1, 2020. I had an amazing time contributing to open source for 3 straight months and this beautiful learning journey of mine concluded on May 31, 2020. If you would like to read about my GSSoC Journey, you can find it here.

GirlScript Summer of Code

Now, the very first question that might come across your mind while reading this is, that how do we contribute to an open source project? Or maybe you might be wondering how do we create our first Pull Request(PR)?

Don’t worry, I have been there and I know exactly how you are thinking. In this blog, I will walk you through the entire process of creating a PR for an open source project.

So, first things first. Let us understand what does contributing to open source actually mean and in fact what is open source?

Open Source Software is a software for which the codebase or in other words the source code, is openly available to all, so that they can view, access and add/modify features to the software in order to help develop the software.

Developers study the existing codebase for the software and then can suggest addition or modification or point out a bug in the codebase to enhance the software. But how do they put forth this suggestion?

So, we have Issues and Pull Requests for the same.

Say, I am the project owner and I have made my project open source. And you are a developer who happens to read my codebase and in the process find a bug. So, you can open an Issue, specifying the change/addition required.

  1. At the same time, if you have coded the solution for the removal of bug, then you can propose your changes via a Pull Request(PR) linked to the created issue. If as the project owner, I will find the proposed changes appropriate, I will incorporate them by merging your PR.
  2. There could be another possibility and that being that you have discovered the bug and opened an issue, but haven’t coded the solution to address the bug. In this scenario, other developers who are reading the codebase can think of a solution and code and create and link a PR to your created issue.

Okay, now there is another possibility, being the project owner, I could be aware of some enhancements that I require in my project, or maybe, I am looking for developers, to help me with a solution/code for certain tasks or bugs. So, in this case, I shall create an Issue specifying the requirements and you or other developers like you can propose changes/solutions by creating and linking a PR with this issue.

So, in a way issues are used to track ideas, enhancements, tasks or bugs in open source projects and PR’s are proposed changes in the project, which are linked with issues. Once, a PR is approved by the project admin and merged in the codebase, the open issue with which, the PR was linked, is closed.

And this is basically referred to as an open source contribution.

Prerequisite — In order to create your first PR, you need to know about Version Control. So, you are advised to learn about Git and GitHub.

So, are you excited for creating your first PR?

Let’s get started.

In order to contribute to someone else’s project, you must follow these steps-

  1. Open the project repository you want to contribute to.
  2. Fork it. This will create a copy of that project under your GitHub user account.
  3. Next, you have to clone the forked repository, by running the command : git clone https://github.com/<YourUserName>/repositoryName on your terminal/Git Bash as you prefer to use. You can also copy this URL directly from GitHub. Click on the green “clone or download” button and copy the URL from there. If you copy the URL the command to run on terminal/Git Bash would be git clone <forked ProjectRepository URL>
  4. Once the repository is cloned, create a new remote for the upstream repository with the command: git remote add upstream <original ProjectRepository URL>
  5. Now, create a new branch and work in it. To create a branch, run the command git checkout -b newBranchName
  6. Now, create or add new files to your local repository and then commit and push those changes, as you would do for your own repositories using git status, git add, git commit and git push commands.
  7. Next, go to GitHub and you will be able to see a green “Compare and pull request” button appear. Click on this button and you will be redirected to a page to create PR. Link the issue that this PR fixes and specify the proposed changes in the conversation. Fill the PR template, if any, provided by the project owners. Finally, click on green “Create pull request button”.
  8. Now, your PR will be reviewed and approved and merged, if found appropriate. Else, some changes would be requested and the cycle would follow.
  9. So, finally you have created your first PR. Congratulations😀!

My first PR for GSSoC’20 was accepted for the project Algo_Ds_Project by Aman Jain. I still remember how happy, I was when my first PR for GSSoC was merged. It felt unreal!

All the best! Happy contributing😀!!!

That’s all for this blog for now!

Signing off, See you soon!

--

--

Sukriti Shah
GirlScript Summer of Code

Flipkart GWC Finalist | Coder | GSSoC’20 | Winner @ National CSI Student Convention | Web Developer & Mentor @ GirlScript Foundation