How to make your first contribution to Open Source? A Beginner's Guide

Tags: opensource, github, git, firstpost
Published: 2021-07-28 06:04:13

I know that you might be thinking🤔 that Is this blog really help you to start your open-source journey? So, I promise you that after reading this blog, you will definitely feel much confident to make your first open-source contribution.

![Alt text of image](https://media.giphy.com/media/f6PLkivnzaxMZwk0MH/giphy.gif)

I am sure that you might be hear about the term “open-source”. And you might be thinking What exactly is it? How can you contribute in it? What are the tech or tools need to know to do open source? How can you get started? So, you are at right place. In this blog, I will cover all this and much more.

## 1. What is an open source?

Open Source refers to the source code that is available for modification, enhancement and anyone can use freely. Open-source software is usually developed as a public collaboration and made freely available. Anyone can also contribute in the source code to make it better. GitHub is also an example of an open collaboration.

## 2. Why should you contribute in an open-source program?

This is the first question that arises in our mind that why should you contribute to open-source programs?
So, there are plenty of purposes such as :
• Learn new skills
• Share your knowledge
• Grow together and learn together
• Gain experience in Real-World Development
• Build your Networking with like-minded peoples
• Networking will help you to grow your career
• Know about the workflow of Git and GitHub
• Brushed up your skills

## 3. Who can Contribute? What do you need to participate in an open-source program?

If you are a beginner then most probably, these questions arise in your mind. And you might be thinking that, Are you eligible for this program or not?  Well, the answer is Yes. You can contribute to open-source programs. 

![Alt text of image](https://media.giphy.com/media/4vV84se27YjvWWS1PU/giphy.gif)

Well, For contributing to any open source program,  you don’t need to have a deeper understanding of any tech. Just need to learn the basics of any tech according to your interest and make contributions.

Let's say, If you know only the basics of HTML and CSS, then you can contribute to any open source project of Web development.  You can make changes in the UI of that project, change color or change the font style. These are very basics issues and you can easily contribute to them.

**_Tip-1_** *: I know, you are much excited to make your first open-source contribution, but before going through all these steps, I would recommend  you to go through this [Git Cheat Sheet](https://www.javatpoint.com/git-cheat-sheet) and download it on your local PC so that you can review it in future.*

## 4. How to get involved in an open-source program?
      
The first step is to register yourself for any beginner-friendly 
  open-source program.

There are some beginner-friendly open-source programs like :

•       GirlScript Summer of Code([GSSOC](https://gssoc.girlscript.tech/))
•	Lets Grow More Summer of Code([LGMSOC](https://gssoc.girlscript.tech/))
•	Script Winter of Code([SWOC](https://swoc.tech/))
•	Delta Winter of Code([DWOC](https://dwoc.io/))
•	NJACK Winter of Code([NWOC](https://njackwinterofcode.github.io/))
•	Kharagpur Winter of Code([KWOC](https://kwoc.kossiitkgp.org/))

*Checkout [this](https://github.com/deepanshu1422/List-Of-Open-Source-Internships-Programs) to know about more open-source programs and open-source competitions.*

After enrolling yourself, I am pretty sure that you will get selected.

**_Tip-2_** *: Try to fill the application form carefully and write your answers properly, You will definitely get selected.*

## 5. How to choose an open-source project?

This is a very crucial step. After getting selected, visit on the official website of that open-source program and Check projects according to your tech interest and convenience.

Within those projects, whenever you catch yourself thinking that something could be better or altered, act on your instinct.

And Make sure, your selected project will follow these things :

•	The project must have a license
•	It should be a recent project that means mentors and admin are active
•	Make sure, people are contributing to that project
•	There should be an active discussion on the project issue
•	Check that mentors are reviewing pull requests of the participants

If all the above conditions are satisfied by the project then you should go for that project.

## 6. Create your first issue 

•	After selecting a project, open that project on GitHub
•	And check what can you make changes so that this project becomes better?
•	Now, after finding an issue on which you can work without any difficulty, visit that project on `GitHub` .
•	There will be a section of `Issues` as shown in this image :

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbf9bci5iek1lislz5vr.jpeg)

• Click here and you will find a option of `New issue`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aog8dc3tdn3uzngp2irx.jpeg)

• After clicking on `New issue`, you will find some type of issue as shown in this image:

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qemxsulrc01p836dlj5w.jpg)

• You can choose any option according to your issue type.
• And Fill all the details of your issue and click on `Submit new issue` button.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/25mclg7fl2mhn2a40i5h.jpeg)

*Congratulation!👏 Finally, you created your first issue.* 

**_Tip-3_** : *I would suggest that you should describe your issue properly and also mention that how will you solve this issue.*

## 7. What can you do to get assigned that issue to you??
•	After submitting your issue, Wait for 2-3 days and a mentor or admin will assign you to work on that issue.
•	If you are not getting any response from a mentor then you can text them on the discord channel (most of the open-source programs make a discord channel). 

• After that, I am pretty sure that you will get assigned and get a message on GitHub something like this :

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wt7wnd3mee1k2bood5om.jpg)


**_Tip-4_** : *I would suggest you to text individually to the mentor on discord or any other platform like LinkedIn, So that they can notice your message and assign you.*

## 8. How to start working on the project?

If you followed all the above steps, then you are good to go.🙌 So let's talk about how to actually start working on the project?

There are few steps such as : 

**(i) Fork the project :** At the top right corner, you will see the term `fork`. All you need to do is click it and you will have created a copy of the same project in your account. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ua59rali2sgwjw1m2bvu.jpeg)

**(ii) Git SetUp :** Now, first thing is need to set your Git environment so that you can work on that. 

If you have Git installed then open CMD, but if you haven't then install it from [here](https://git-scm.com/downloads).

There are two steps to setup your git environment :

**(a)Set your user :** You need to set your user name because every git commit use this information. So use this command to set your user name : 
```
$ git config --global user.name "Your_Name"
```
**(b)Set your email address :** Also you need to set your email address and for that use this command :
```
$ git config --global user.email <your_email@gmail.com>
```
Finally, you are done with the Git Setup. Now, You can work on that.

**(iii) Initialize your Project as a Git Project:** Before cloning the project, first thing is to initialize your repository as git repo. So for that, run this command:
```
$ git init  
```
This command is used to create a new blank repository and to make an existing project as a Git project. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zkkuqoytqfaq1bxdr2wy.jpg)

**(iv) Clone the project :** Now, You need to copy the link of that project, which will be available under the `Code` option as shown :

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yomx2ybc7m9t7bwodq22.jpeg)

So, now to clone the repository, use this command :

```
$ git clone <url>
```

This command will create a copy of the project on your local pc.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/245tsiaybwv2dvagmh5s.jpeg)


**(v) Create a Branch:** Before start working on the project, you need to create a branch. Run this command to create a branch:

```
$ git checkout -b <your_branch_name>
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1xzo3krhk5rj3vcnw65.jpg)

•	As shown in the image, before creating the branch, we were in the master branch.
•	After creating a branch, we will enter into our newly created branch
•	We can also check all the branches present in the project by using this command:
```
$ git branch
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2ysv393nrj6cjxl6c9s.jpg)

• Now, you can see in the image that there are two branches in our project:
**a. master branch:** This will always be present in your project as default or main branch.
**b. new branch:** This is our newly created branch.

•	We are in our newly created branch `newbranch` that’s why it is shown in green color and now, you can write your code in that project.


**_Tip-5_** : *Try to run `$ git status` command as much as possible to check the status of your project at any instant.*

```
$ git status
```

## 9. Add and commit your changes:

After making the required changes in your code, you need to add and commit these changes to your project. 

• To add your changes run this command :
```
$ git add -A
```

• Run this command to commit : 
```
$ git commit -m "Your_commit_message"
```
This command is used to create a snapshot of the staged changes along a timeline of a Git project's history.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2l6iu3mxr1ypjjtyrtb.jpg)

After running the `$ git status` command, we can see in the image that the working tree is clean.

You can also use `git log` command to check the history of commits that are made in the repository.
```
$ git log
```
After running the `$ git log` command, you might be thinking that how to return back to your CMD. So, for that Press the q key to return to your command prompt.

**_Tip-6_**: *Write your commit message properly. You can write about what you made changes in that repository?*
 
Let's say you created an issue to make changes in a submit button. Then your commit message should be like :
```
$ git commit -m "Modification in submit button" 
``` 

## 10. Push your project to the GitHub

Now, you need to push your project. The git push command is used to upload local repository content to a remote repository.  Use this command for pushing your project :

```
$ git push origin <your_branch_name>
```
or
```
$ git push --set -upstream origin <your_branch_name>
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mv9mrpegc4t4jw4f02id.jpeg)

**_Tip-7_**: *You are doing great. Just try to explore more git commands. And if possible, you can take a print out of the `CheatSheet` and paste it near your study table.*

## 11. Create a pull request :

After pushing your project, visit on GitHub and there you will find a big green button of `compare & pull request` as shown in the image : 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ycmmrq9gto0e6kgopzi3.jpeg)

Click on that and create a pull request in the given format of that project such as :

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vyyqu8wv48buugmoc6nv.jpg)

**_Tip-8_** : *You can also commit an additional message as shown in the image, so that mentor can review your pull request soon.*

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qp1pz4r1q4luuvlnpqjh.jpg)

Congratulation!🤩 Finally, you created your first pull request. You should feel proud on yourself for making your first contribution to an open-source program.

![Alt text of image](https://media.giphy.com/media/2hfFmnev3vdNTYKR6x/giphy.gif)