If you're a developer, you've probably come across the term "open source." If you've ever wondered what it's all about and how to contribute, you are in exactly the right place.

I put aside all my fears about how and what to contribute during Hacktoberfest 2020, and made my ever first contribution to the open source world. Since it was my first time, I started with some beginner friendly projects and slowly got more advanced.

Now, if you're a new developer you are probably wondering what exactly is open source? How can you get started? What should you expect? Well, in this article we will cover all this and more.

What is Open Source?

Open source refers to source code that is made available to the public to view, use, modify, and distribute under a permissive license.

It's often in a company's or person's best interest to open-source their code, whether they're an individual, a corporation, a small business, a non-profit, or a government agency.

Contributing to open source projects can be a rewarding way to learn, teach, share, and build experience. There are plenty of reasons why you should contribute to an open source project, such as:

  • To improve the software you rely on daily
  • To find a mentor if you need one
  • To learn new skills
  • To share your skills
  • To gain a much deeper knowledge about the software you're using
  • To build up your reputation and help grow your career
  • Plus, it's fun and gives you personal satisfaction

What is your motivation to contribute to open source projects? Let me know by responding to this post or via larymak1.

How to Contribute to Open Source

Contributing to an open source project does not necessarily mean that you have to contribute to the codebase. You can contribute to open source in many different ways, like:

  • You can add a description to a project's documentation to elaborate on a certain point
  • You can give guidance on a specific project
  • You can add examples to show how the code works
  • You can write tutorials for the project
  • You can add a translation for a project
  • You can answer questions about a project (like on Stack Overflow or Reddit)
  • You can offer to mentor another contributor
  • You can fix typos and arrange the project's work folder correctly

All of these ways and more count towards contributing to an open-source project.

What to Know Before You Contribute to an Open Source Project

Every open source community is different. Each community has different people in it with different roles and rewards offered. They also each have their own rules and expectations for contributing.

A typical open source project will have these people:

  • Author - This is the person who created the project. They have the power to assign new roles to other members to help with the project's maintenance.
  • Owner - The ownder has administrative ownership of the project (and can be the same person as the author)
  • Maintainers - These people are responsible for driving the vision and goals of the project. They're usually people who feel responsible for the direction of the project and who are committed to improving it
  • Contributors - Contributors add to the project in one way or another. They follow the same code review process, are subject to the same requirements on code style, and so on.
  • Community Members/Users - These valuable members of the community can provide feedback about features, bug reports, and more.

Important elements all open source projects should have

Every open source project should have the following guidelines and information:

  • License - If a project does not have an open source license, then it is not open source. The license helps protect contributors and users. Businesses and savvy developers usually won't touch a project without this protection. If you're wondering how to get one, click Here to read more.
  • README - This is a manual that explains how to get started with the project. A good README should contain different everything a potential contributor would want to know about the project. You can read more about how to write a good README file HERE.
  • How to Contribute - These guidelines help people contribute and show what type of contributors are needed (this file is not a must)
  • CODE_OF_CONDUCT - A code of conduct is a document that establishes your expectations for how your contributors and participants behave. Adopting and enforcing a code of conduct can help create a positive environment for your community.

To create an open-source project you will want to create an environment where people can share their challenges and have in-depth discussions. This is made possible by the following tools:

  • Issue Tracker - This is where people discuss issues related to the project
  • Pull Requests - This is where people review changes in progress
  • Synchronous Chat Channel - This is specifically meant for people to share their ideas and have conversations (like Slack, Discord, and so on)

How to Find a Project to Contribute to

Now that you know how an open-source project works, it's time to find a project to contribute to.

Contributing works on all levels – don't over think how you're gonna do it. Instead think of some of the projects you already use and how you can make a change to them or improve on them.

Research has shown that around 30% of casual contributions are documentation, typo fixes, or even translations.

If you are a first-time contributor – which everybody was at some point – here are some links that will get you started in the open source world:

In the world of open-source software, issues get reported and fixed pretty quickly. So, if you want to take on an issue, be sure to try to work on it promptly.

How to Choose an Open Source Project

After you have found the project you want to help out, make sure it meets the following criteria to be sure it's a good candidate:

First, you will have to check:

  • Does it have a license file?
  • When was the latest commit done? Was it recent? (That is, is the project actively maintained/worked on?)
  • How many contributions does it have?
  • How often do people make commits?

If you see lots of recent activity, that's good – it means it has an active community maintaining it.

Now you should move on to check the following:

  • How many open issues are there?
  • How long does it take for maintainers to respond? Are they prompt?
  • Is there an active discussion on an issue?
  • Are the issues getting closed regularly?
  • How many open pull requests are there?
  • How recently were the latest pull requests merged? Recently?
  • Do the pull requests get reviewed first? (They should be.)
  • Do the maintainers thank people for contributing?

If all the above conditions satisfy your needs then go for it and start contributing to those projects.

What to Consider Before You Go Open Source

Okay, so you can't wait to start contributing to your first OS project. Let's go through a few tips that might help you choose what to work on.

What Programming Language Does the Project Use?

The most fundamental technology behind any application is the programming language it uses. Some of the most popular languages on GitHub are JavaScript, Python, Java, Ruby, and PHP – but there are many more.

There is a multitude of projects that might suit your skills and interests. So just find one that you'd feel comfortable working on.

Type of project

After you've chosen the language you want to work in, you need to choose the type of project you prefer. Just have a look around and pick a project on a topic that interests you.

Once you've found a project, you'll want to actually make contributions. And you'll do that by submitting pull requests. Let's talk about that now.

How to Submit a Pull Request

If you are at this stage, you have found a project and you are good to go. So let's talk about how to actually submit a pull request.

First, what is a pull request? It's the way that you request an update in GitHub, and it's how you get someone to check your code before merging it into another branch

Steps to Submit a PR

  • Fork the repository
    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. The URL will change to:
https://github.com/<YourUserName>/projectname
  • Clone it to your local machine
    On your computer, if you have Git installed open the CMD and run this command. If you don't have Git already, refer Here which will show you how to get started with Git. Then proceed with the steps below:
git clone https://github.com/<YourUserName>/<projectname>

This will create a copy of the project on your local machine. Now that you have cloned the repo we will need to do two things:

First, you'll need to create a branch. Change to the repository directory on your computer (if you are not already there): You can do that by:

cd project folder name

Now create a branch using the git checkout command:

git checkout -b your-new-branch-name

For example:

git checkout -b lary-mak-blog

Next, you'll need to make the necessary changes and commit those changes. After making your changes and adding new files, its time to add those changes to the branch you created.

To see all the changes you made, run the git status command:

git status

This shows all the recent changes you made. Now to add them, use the git add * command:

git add *

Now commit those changes using the git commit command:

git commit -m "<initial commit> "
  • Pushing Changes to GitHub
    You can do this easily using the `git push command:
git push origin <add-your-branch-name>

replacing <add-your-branch-name> with the name of the branch you created earlier.

  • Submit Your Changes for Review
    If you go to your repository on GitHub and refresh the page,you'll see a Compare and pull request button. Click on that button.

Soon the maintainer will merge all your changes into the master branch of this project (unless they need changes from you). You will get a notification email once the changes have been merged.

A pull request to another repo is similar to a “push”. However, it allows for a few things:

First, it allows you to contribute to another repo without needing administrative privileges to make changes to the repo.

Second, it allows others to review your changes and suggest corrections, additions, edits, and so on.

Third, it gives repo administrators control over what gets added to their project repo.

What Next After Your First Pull Request?

Congrats! You just completed the standard fork -> clone -> edit -> pull request workflow that you'll encounter often as a contributor!

Now find a project and make some more contributions. And be sure to watch out for open source month held by Digital Ocean so you can participate in Hacktoberfest and get a chance to win some cool stuff.

Benefits of Contributing to Open Source

Now that you have seen how you can contribute to OS, what are some of the benefits of contributing?

  • People that contribute to an open-source project get to know the technology at a much deeper level than they would be simply using the technology
  • You can focus efforts on adding and leveraging features that will benefit businesses based on experience with what works and doesn't work in the real world.
  • It builds your morale and reputation. People who contribute to open source projects have access to other community members' insight and experience.
  • Contributing to open source provides a clear view into the future of a project
  • If you're on GitHub, a large portion of the things you do on that platform are public. Use this to your advantage by always doing your best when contributing and communicating with fellow contributors. You never know who is looking, your next employer might be there 😊

Why You Should Contribute to Open Source

As a developer, this is why I think you should contribute to open source:

  • It helps you write cleaner code
  • It helps the community and your peers get to know you. This recognition can bring you a lot of opportunities in your career.
  • It helps you learn more about a project
  • It improves your coding skills

For more information, read freeCodeCamp's guide.

If you have read this far, I really appreciate it!

Connect With me at Twitter | Insta | YouTube | LinkedIn | GitHub

Do share your valuable opinion, I appreciate your honest feedback!

Enjoy Coding ❤