How to Contribute to Open Source Projects? [Beginner Guide]

How to Contribute to Open Source Projects? [Beginner Guide]

Beginner's guide to open source contribution

Β·

7 min read

Play this article

Hey Guys! This is Shivam.

Today, we are going to discuss Open Source. We will learn:

  • What is an Open Source?
  • Basic Git Commands you need to start
  • How we can contribute to an Open Source?
  • Example to contribute to an Open Source
  • Which community you should join to get opportunities?

Let's start with a definition of an Open-Source.

What is an Open-Source?

Open source term was coined by software developers in which a group of developers come together and develop and software application and make public accessible.

Not only that, in an open source software application, anyone have permission to make the changes as per their choice.

For example, React was developed by Facebook developers, but today anyone from anywhere in the world can access it and request for relevant changes.

What is GitHub?

In simple terms, GitHub is a code hosting platform where you can upload your codes like you upload videos or photos on Social Media apps.

If you and your friend want to work on the same project but you are in different places then at that time Github comes into the picture and, we can share our code.

Now, one thing you always keep in mind before getting started with an Open-Source or GitHub is that "GitHub is for Collaborating not for a Competition".

So, if you want to collaborate with people, learn in public, help others by contributing, and want to grab opportunities then, you can join GitHub and start your journey.

Basic Git Commands

To start contributing to a project you need to learn about "Git Commands".

Now here I am not going to deep dive into Git Commands because today we are focusing on the contribution part. But I will tell you some of the basic commands from which you can start.

Now, let's see the basic commands of Git to contribute to an Open Source.

  • Git Status: The git status command displays the state of the working directory and the staging area
git status
  • Git Commit: The git commit command captures a snapshot of the project's currently staged changes.
git commit -m "Write about what you change in the project"
  • Git Push: The git push command is used to upload local repository content to a remote repository.
git push
  • Git Clone: git clone is a Git command line utility that is used to target an existing repository and create a clone or copy of the target repository
git clone "ssh key"

-- will talk about the ssh key during the example

Here are some of the basic commands you should know about during your contribution. But apart from these, there are more git commands.

image.png

Now let's start with an example to understand contribution in GitHub.

How we can contribute to an Open-Source?

To contribute to a project you should have a GitHub account. If you have not yet, you can create it here.

Now, after creating an account you can find projects based on your skills for contribution.

For this Tutorial, I choose the project named HactoberFest. I recommend everyone new to GitHub contribute to this Repository.

Now, for this contribution I am going to use "VS Code" you can choose any code editor.

  • Let's start with a contribution. Click here and you will land on this pageπŸ‘‡

image.png

  • Now click on the Fork(Fork is like a copy of that project) button to Fork this Repository.πŸ‘‡

image.png

  • Now, this window will appear, Click on "Create Fork" to fork the Repository.

image.png

Now you will see that the same Hacktoberfest repository is appearing in your account now(You can see your name in the left corner). And below your name, it is written that Forked from EddiehubCommunity, which means that we made a copy of EddieHubCommunity's project. Now you can edit this project.

image.png

  • Now click on the code button which appears in green color.

image.png

And the drop-down will appear. Click on the "SSH" and copy this "SSH key". ssh key helps you to link your remote repository with your local repository.

Now if you don't have an ssh key you can make a new one by following this article or for now you can start by clicking GitHub CLI or HTTPS. Click on any one of three and copy that key.

image.png

  • Now after copying, go to your code editor and a new fresh folder and open up the terminal in it. Now we are going to clone that repository by running the below commandπŸ‘‡
git clone https://github.com/YOUR_GITHUB_USERNAME/hacktoberfest-practice.git

-The above command looks like this πŸ‘‡ in the terminal.

image.png

Now, we are switching to this repository's folder for that we run the cd command.

cd folder name

You can do like this πŸ‘‡ here our folder name is hacktoberfest-practice

image.png

  • Now we are in this folder, now we can start contributing. Before contributing to any project you should read that project's Readme file.

  • Now for this contribution we go to the readme file. You can see that readme file which appears on the left side.

Note- Every Project has different-different contribution guidelines. So, be sure you check out that project's readme file before starting to contribute to it.

Now click on the readme file.

image.png

  • Now, after clicking on the readme file you will see this screen.

Now if you scroll down a little bit you will see, that there are many names present in it. These are the names that are added by many different contributors. Now, we will be adding our name to it and being the contributor

image.png

  • So, now scroll down the screen as per your name's first letter. My name starts with the letter S so, I will scroll till S and write my name.

Write this command where you want to add your name.

[Full Name](https://github.com/your-username)

-- don't do any typo mistakes.

image.png

Now, after writing your name check the status of the file, by typing this πŸ‘‡ command in the terminal.

git status
  • Here you will see the file name which you just changed in red color.πŸ‘‡

image.png

Here it is not staged yet so, we will now stage this file by writing the commandπŸ‘‡ in the terminal.

git add filename
 or
git add.
  • Now after staging it again run the status command. Now, at this time you'll see that it is showing with green color.

image.png

  • Now we will commit this file. In simple terms, commit means, leaving a note to that file, which helps, later on, to understand what change you do on that file. So, for commit, run this command. πŸ‘‡
git commit -m "Any message you want to add"

This will look like thisπŸ‘‡

image.png

And, when you press enter you will see something like thisπŸ‘‡. Here it will show you how many lines you changed or deleted.

image.png

Now we will push our local code to the remote repository, to do that we will run this πŸ‘‡

git push

It will look like this πŸ‘‡

image.png

Now go to your GitHub account and click on the Hacktoberfest repository. There you'll see the all files. Now click on the Pull Request where you'll see this πŸ‘‡ screen.

image.png

Click on the New Pull Request option and, you'll see this screen πŸ‘‡

image.png

Now click on the "Create Pull Request" option. Now, this πŸ‘‡ screen will appear. Write your name in the text box as you can see in the image below I write mine(Don't do any other changes).

image.png

Click on the "Create Pull Request" button and you will see this πŸ‘‡screen with your account name.

image.png

Here you created your "Pull Request(PR)". After some time there will be a message which gonna be look like thisπŸ‘‡. It means your first Open-Source Contribution is done.

image.png

If all checks don't pass it means, you have done something wrong and you have to do some checks where you edit the code.

Conclusion

So, this is the contribution process of GitHub. You should have to contribute daily, Just give 1 hour a day to open source, and then, the response will be going to surprise you.

Things to Remember

  • Don't hesitate to ask questions
  • Don't think you don't have skills. A person with 0 skills can also contribute
  • Join Good-Good communities for more improvement.

Community You Can Join

There are many good communities on GitHub you can join any of them it's up to you. Here are the 2 communities which will help you to understand more about OpenSource.

Thank You

Hope you'll learn something from this blog. If you found something good don't forget to give your feedback.

You can join me here πŸ‘‡ for more daily updates.

Twitter GitHub Showwcase LinkedIn

cta-hashnode.png

Try for Free

Did you find this article valuable?

Support Fueler Blog by becoming a sponsor. Any amount is appreciated!

Β