Introduction:
What comes to your mind when you hear the term “Open Source”?
Open Source Software is created on source code that is open to all. This means anyone can view and collaborate with the source code to make new changes. Nowadays open source software (OSS) development has made significant contributions to the real world and has transformed the way software is created, shared, and utilized.
As we continue to advance technologically, most developers and companies are moving forward to use open-source tools and software to make them better. And I think you will also agree that the number of contributions to open-source is growing gradually day by day not only for developers but for companies also.
My first-ever contribution to the world of open source was during the HACKTOBERFEST event in 2022. As a beginner, I participated in front-end beginner-friendly projects and also worked on some documentation which I’ll be sharing later to help you out too.
Now, I know that if you’re reading this article it’s because you want to be a part of the open-source universe, but maybe you don’t know where and how to start the journey of it. Well, then you’re in the right place.
In this guideline, I aim to cover the following topics and some more:
-
What is Open Source?
-
What to know before starting contribution to OS projects?
-
How can you start contributing to Open Source Projects?
-
Basic knowledge of git & Github
-
How to create a repository?
-
How to create an issue?
-
How to create a Pull request?
-
Benefits of Open Source Contributions.
So, let’s get started!
What is Open Source?
In simple terms, an open-source project is like a piece of code or software that is available for anyone to see, use, run, and modify.
For example, it's similar to your math teacher's notebook. Let's say your teacher shared their notes with you, and you copied them into your notebook. If you find an error in one of the solutions, you can't directly correct it in the teacher's notebook. Instead, you need to propose the correction to your teacher. If your teacher agrees that your solution is correct, they will update their notebook, and the correction will be reflected in the main copy.
That's how an open-source project works. Once a project is made public, if you want to add a feature or make a change, you need to make the changes in your copy. Then, the owner of the project needs to review and approve your changes before publishing them for others to see.
Open-Source workflow
Contributions to open-source projects can be small, such as fixing a typo or a small bug, or they can involve adding detailed documentation for an entire project. Every contribution, no matter how small, contributes to progress. When these small contributions are combined, they can lead to significant changes and improvements.Just as Vincent van Gogh said:
Great things are done by a series of small things brought together.
What to know before starting to contribute to OS projects
Before you start to contribute to open-source projects you need to know some basic things.
- Roles in general OS projects :- In a typical open-source project we have people with some special roles
- The owner (Author):- This is the person who has created the project and has administrative ownership of the project. This person has the power to assign new roles to other people and maintain the whole codebase.
- Maintainers:- These people have access to the code base to manage it efficiently. These people are responsible for driving the vision and goals of the project. They review PRs, assign contributors to issues, close unwanted issues, and PRs, help the owner/author maintain the codebase, etc.
- Contributors:- These are the people who want to make changes in a project. They don’t have direct access to the codebase. If they want to make some changes then they have to do it in their copy of the project.
- Elements of an OS project: - All open source projects must have some elements that tell others about the project, tech stacks used in the project, languages used in the project, how to contribute to the project, etc.
- License:- An open Source License is a legal agreement that determines under which contributors can modify or access the code of the open-source software. If a project does not have any open source license then the project is not considered as an open source project. If you are facing any problems choosing a license for your project you can check out the Official OS Website
- README:- This is a manual that contains the complete documentation of the project. The manual provides instructions on how to get started with the project and how to run it locally. A well-written README file can provide contributors with all the necessary details about the project. You can write a README using an online markdown editor, which allows you to format and structure the content conveniently. You can write a readme in the online markdown editor here .
- Contribution Guidelines:- These are guidelines that help contributors to know how to contribute to a project. This file includes valuable information like how to fork the repository, how to run the project locally, how to make a pull request in the project etc. Even though it’s not mandatory to add this file to a project good practice is to add one. If you need help understanding one or writing one you can check the Contributor Guideline template .
- Code of Conduct:- This is a document that describes your expectations for how your project contributors behave. Code of Conduct file can help to create a warm and positive welcoming environment for your community. You can check more details here .
- Issue and Pull Request – It is one of the most important topics to understand in open-source development.
If you come across an error or bug in a project, you can create an issue to report it. Once the issue is assigned, you can start working on resolving it. Additionally, you can also create your issue if you have identified a problem or improvement.
Once you have completed the work related to the issue, you can create a Pull Request (PR) to the base branch. The project owner or maintainer will review your changes, and if they approve, they will merge your changes into the base branch. During this process, you can engage in conversations with the maintainers within the PR to discuss your changes. We will discuss how to create an issue and a Pull Request in a repository later on.
How can you start contributing to Open Source Projects?
You don't need to overthink about how to contribute. Instead, consider the projects you already use and think about how you can make a positive change or improvement to them. Research has indicated that approximately 30% of casual contributions involve tasks such as documentation updates, fixing typos, or even translations. As mentioned earlier, I will now share some of the projects in which I made my first contributions during Hacktoberfest 2022. Here it is:
- Here is the Pull Request for my changes. During that time, as a beginner,
I worked on some basic CSS in this project. You can also begin your journey by making similar small contributions.
- Here is the Pull Request of my changes in this project. This is a collection of web-dev projects. I created a to-do list and added to this project.
- Here I worked on three issues. Two of them were related to documentation (JavaScript Cheatsheet added and Readme. md updated)
- The third issue involved creating a simple Whatsapp Clone within this project. You can also begin your open-source journey by making similar easy contributions to documentation.
You can check these examples to get an idea of open-source work. They can help you understand the nature of contributions in open-source projects. I hope they inspire you to start contributing to open-source projects yourself. Now, let's explore how to choose a good open-source project to contribute to.
How to Choose an Open-Source Project
It’s good to check some criteria before contributing to an open-source project. Let’s see some of the checks that you have to do:
- Check if the Project Repository has a license file or not.
- Check how frequently Pull Requests are being merged in the repo. It will give you an idea of if the maintainers are active and also provide an estimate of how long it may take for them to respond to your contribution.
- Check if the Project has any open issues or not. If yes then it’s good news for you, you can ask maintainers to assign the issue to you and if no issues are open then you will need to test the project and create your new issue.
- Evaluate the responsiveness of the maintainers in assigning issues to contributors.
- How many Pull Requests are open there? It will give you an idea of how frequently the PRs are closed by the maintainers.
These are some basic checks that you can do before starting to contribute to an open-source project.
Basic knowledge of Git & GitHub
I know that you’re super excited now to move your first step in the world of open source community. But before that, you need to know some basic knowledge about Git & GitHub. These are optional prerequisites, but if you make yourself aware, you will enjoy contributing to Open Source even better.
- Git: If you know Git already, then it’s super cool. You’re set to start. If not then I’m here to give you some basic knowledge about what Git is. Let’s see -Git is the version control software that runs locally on your machine. It is mainly used for:
- Tracking the code changes
- Tracking of who made changes in the code
- Coding collaboration
- For more knowledge you can refer here or Official GitHub docs
- You have to know some basic git commands for doing contributions. I’m sharing some cheat sheets from where you can practice all the commands:
- Atlassian Git Cheat Sheet
- Handmade Git Cheat Sheet by Resourcio Community
- GitHub: GitHub is a service that hosts Git repositories in the cloud and makes it easier to collaborate with other people. If you do not have an account in GitHub then create one now from here .
How to create a new repository in GitHub?
There are several steps by which you can create your first repository in GitHub. Let’s see how to do it:
- First, you need to have a GitHub account. If you do not have then create one.
- Log in to your account.
- Then you can see the “New” button on the left side of the page, as seen below. Click it.
- You will see a page as shown below. Fill in the details for your repository, such as the repository name and description. You will also need to select whether you want the repository to be "public" or "private". If you want to include a readme file, you can check the corresponding option. Finally, click on the "Create Repository" button.
- Congratulations! You have successfully created your first repository in GitHub.
How to create an issue in a project?
Let's assume that you have found a project to contribute to, and within that project, you have identified a bug that you can fix. To address the bug, you need to raise an issue.
Here's how you can do it:
- Go to the project’s repository (Give an example of one of my friend’s projects)
- Click on “issues”
- Click on the button “New Issue” to create a new issue
- Provide a title for the issue and write a brief description of the change you want to make. It is good practice to attach a screenshot of the specific portion of the project where you intend to make the change. Once you have done this, click on the "Submit new issue" button.
- Congratulations! You have successfully created a new issue.
Here as an example, I have created the issue for updating the “README.md” file of this project.
How to make a Pull Request?
Now that you have learned how to create an issue, if you have reached this stage, it means you are ready to make your contribution to the project. Let's discuss the process of submitting a pull request.
- At first, you need to fork the repository. By forking you will have created a copy of the same project in your GitHub account. All you need to do is click on the “Fork” button as seen below:
- You can see under the “owner” now there my name is showing. This means now I’m going to create a project of this copy where I have access to edit and modify the code base. Now click on the “Create fork” button.
- It will take some time to create the fork. You can see in the picture that it’s showing “forked from Ayishik/Photogram”, which means we have successfully created a copy of the main project in our profile. Now let’s move ahead.
- Now it’s time to clone the project into your local machine. To perform this step, you must have installed Git on your local machine. If you don’t then I will say to refer to this docs on how to get started with Git
- Now click on the “Code”, and you will see an HTTPS link `https://github.com//.git`
- Copy it by clicking the button which I have marked by an arrow in the image:
- Now in your local machine, open git bash and write this command for cloning the project: git clone https://github.com//.git
- After cloning the project in your local machine you will navigate to the project folder by writing this command in the git bash: cd project_folder_name
- Now, you will make sure that all the changes you will do, will be on a newly created branch. Let’s create a branch first. For good practice, give the branch name related to the work: git checkout -b .
- Here I have taken my branch name as “readme”.
- Now you’re good to go to make changes in your branch. After doing the changes run this command in the git bash:git status
- It will list all the changes you’ve done in your branches. But you will see that all the changes are un-staged. So first you have to stage all the changes.
- Here I have changed the README.md file. You can see that it’s saying “modified: README.md”
- To add all the changes you’ve done you will run this command in the git bash: git add . It will stage all the changes. Now you have to commit to the changes. These are the messages by which maintainers will get to know about your changes in the code.
- Let’s add the commit message, briefly explaining what you’ve done in the code: git commit -m “”
In my case, I have written this as the commit message
- After it, there is only work left that is doing a Pull Request for these changes. As everything is set, it's time to let our maintainer know what we have added. That is made possible by pushing the changes with this command: git push origin < your-new-branch-name>
- Here you will replace “your-new-branch-name” with the branch-name you’ve created. As per my example, it is git push origin readme .
- Now after this, if you go to your (forked) repository, you will see a “Compare & pull request” button. Click it and make the Pull Request with necessary details added.
- Now give the Pull Request a “title” and a brief “description” of the changes you’ve made. Then click on “Create pull request” button.
Soon the maintainer will review your changes and if there is any problem they will request you to make changes or if not, they will directly merge all your changes into the master branch of this project. You will get a notification email once the changes have been merged.
Congratulations 🎉,
You just learned and completed the fork -> clone -> edit -> pull request workflow which sums up to your first contribution. This will be your major coding cycle in open-source as a contributor.
Benefits of Open Source Contributions
- Open Source projects are a great way to learn. You can acquire new knowledge and skills by contributing to projects, and by observing others' contributions, you can learn a lot.
- Contributing to open-source projects allows you to explore and learn new technologies and tools. For instance, while making contributions, you may come across programming languages, frameworks, or tools that you have never encountered before.
- Engaging in open-source projects can enhance your resume and make it more impressive.
- One of the significant advantages of contributing to open-source projects is the opportunity to connect with other developers. This means you can meet new people, collaborate with fellow developers on new projects, find mentors, and have the chance to learn from one another.
- Since open-source projects typically involve teamwork, they help improve your communication skills.
Before wrapping up, I would like to give you some open-source program’s names. By participating in these open-source programs you can start your open-source journey:
- Google Summer of Code
- Girlscript Summer of Code
- Winter of Code
- Outreach
- MLH Fellowship
- Hacktoberfest
These are some open-source programs in which you can participate.
Wrap up!
If you have read this far, I appreciate it. Open Source Universe is waiting for you! Don’t forget to share your valuable feedback.
Connect With Me
You can connect with me on Twitter | Linkedin In | and Github
Happy Coding