Beginners Guide to Open source Contribution — Github

Nidhi Vanjare
6 min readMay 24, 2021

Open source contributions are necessary as we can learn and develop many skills with it. There are few steps that every beginner should know before starting open source contribution.

> Github desktop (https://desktop.github.com)

Step 1: Fork

After choosing the project that you want to contribute (parent project) in ,first you have to fork the project in order to contribute your changes to the said parent project.

For instance : If this is your parent project and you have to contritute here then click the fork button to the upper right corner.

After you click fork there will be a pop up.

Then click on your username/organisation where you want to fork the parent project and then will navigate you to your local repository where the parent project is forked and ready for your contribution.

Step 2: Clone

Now before you start coding it is recommended to create a separate branch other than main branch where you can make the changes. After downloading your Github desktop it will be easy for you to pull and push the changes.

click on code > Open with Github desktop

This will redirect you to GitHub desktop where you have to clone the local repository to your machine.

click clone.

Main purpose is to contribute to parent project that we forked. So “To contribute to parent project” is already selected then click continue.

Your Github desktop screen will look like this.

After you clone you project via github desktop the copy of the project folder will be created in your local machine.

For you to add a feature or any other changes to parent project you have to create a branch. This is recommended so that your main branch is kept clean.

Step 3: Create New Branch

For creating a new branch via github desktop

go to current branch > new branch > add name of the branch > create branch

Now you have to publish the branch on GitHub ,so click Publish Branch on Github Desktop.

And Now you can see the branch on your forked Github repository.

Step 4: Commit and Push

Any changes that you do in you project, you will be able to see them on github desktop (also notice the branch name)

After you have made some changes that you desire to add in the parent project. For that to happen you have to first add these changes in your local repository.

Add a commit messages so that you know what changes you have committed every-time. click commit to branch name.

After you commit you have to push the code so -> push origin.

Now you can see the changes on your local repository on GitHub.

Before you move on you could see something like this.

Then you have to fetch the upstream. This happens when there were changes made to the parent repository after you had cloned the project and made changes. You need those changes in your branch to make that branch even with the parent Branch (main/master).

After fetch and merge your branch will be even and when you commit you changes, your branch will be ahed of the main branch as your branch has some extra changes that parent branch does not. (as shown in the screenshot before)

Step 5: Pull request (PR)

For the owner of the parent project to know the changes that you wish to add you have to create a pull request. You can create a PR via GitHub or Github desktop.

OR

Both will navigate you to the parent repository on Github. In the write section you can explain the changes that you wish to add. (You can change the name of PR too. )

Notice the “able to merge” sign. That means your branch does not have any conflict with the parent branch. But you would not have been able to merge the PR if there was some conflict. This can happen if you forget to merge the upstream or some other reasons.

Once you are done explaining click > create pull request. You can see your PR in PR section of parent repository.

Once the owner sees you changes and wishes to add them then he/she will merge it into parent repository. Once the PR is merge you can see it in the parent repository.

Note : You can create a number of commits for one PR. It is recommended to commit and push the changes at the end of the day and to fetch the upstream once you start coding again.

For most of the Open-source contribution competitions it is necessary to first create an issue where you have to explain the changes you will make and then the owner of the project will assign you the issue. After that you can follow these similar steps for your contribution.

Thank You, Happy Coding !

--

--