Getting Started With Open-Source: How To Contribute
Learn how to contribute to Open-Source projects as a beginner

Search for a command to run...
Learn how to contribute to Open-Source projects as a beginner

No comments yet. Be the first to comment.
If you've ever wondered how AI applications generate images from user prompts, you've come to the right place. In this article, you will learn how these tools work by building an AI application to generate images. Create the application We'll start b...

This article covers the conventional way of building full-stack applications and why manually building your backend is not always the best choice. You'll see an alternative solution for your backend needs that can be used standalone or coupled with y...

Find a developer job that allows you to work from anywhere

These resources help you prepare for your next technical interviews

These resources help you improve your CSS skills and they also help you save time

Article written for Asayer and published on their blog originally.
Contributing to open-source projects is a great way to improve your programming skills and contribute to the community. Also, it's important to note that contributing to open-source projects is not all about coding. You can contribute in other ways. For example:
Before going further, I advise you to read the code of conduct and the contribution guidelines. Please read them carefully before you start contributing because it explains what is expected from you. It also describes the workflow required to make contributions. The Open-Source guide has a great article on this subject - Your Code of Conduct.
Are you ready to make your first contributions? Let's do it!
Finding a project to contribute to is a difficult task. I advise you to start small and pick a small project at first. Why? Things move faster in a small project, and it's more likely to get your first contribution. But if you feel adventurous, you can start with a bigger project!
Moving further, there are a handful of useful websites which you can use to find projects and issues suited for beginners. Here is a non-exhaustive list:
These websites should be more than enough to find a project. If not, you pick a tool that you use daily and contribute to that if it's open-source.
This article assumes basic knowledge of Git. The Git workflow you will be using is as follows:
The above workflow is the most basic one, and it's enough to contribute to open source projects. It's important to note that there are other variants, as well. However, you will use this one in the tutorial.
Let's assume you found the perfect project to contribute. I will use the OSS-Contribution repository I created a while ago for this tutorial.
Figure 1
Go to the repository page, and click on the Fork button, as shown in figure 1 above!
Why fork it first and not clone it directly? When you fork a project, you make a copy of it in your account. As a result, you can work on it without affecting the original repository. Forking creates a separate copy, whereas cloning downloads the project on your machine. Also, you cannot make changes to the repository if you only clone it. Only authorised people can make changes. By forking the project, you can make changes and submit pull requests.
After the forking is complete, it will redirect you to your copy of the project. Now it's time to move onto the next step.
Now clone the project from your account. Go to the repository page to find the link.
Figure 2
To find the forked repository URL, click on the green button saying Code and copy the URL as shown in figure 2.
After copying the link, go to your terminal and run the following command (replace the URL with yours):
git clone https://github.com/catalinstech/OSS-Contribution.git
Wait for the repository to download and then open it in your favourite code editor.
Before making any changes to the codebase, it's important to create a new branch. Branches allow people to work on the project without getting into conflict with each other. Also, each branch is independent of others, so your branch's changes are not visible in another branch (unless they are merged).
In the simplest words, your branch holds the changes you make to the project. Also, read the branch naming convention of each project. All projects specify how you should name your branches. Some examples are:
your_name/issue_fix - E.g. catalinpit/add-name-768issue_number-issue - E.g. ET182-Fix-broken-navbarMoving on, you can create a new branch and switch to it as follows:
git branch <your_branch_name>
git checkout <your_branch_name>
Alternatively, you can do the same thing in one command as follows:
git checkout -b <your_branch_name>
Now that you created a new branch, you are ready to make changes! Move onto the next section.
Figure 3
The next step is to make changes in the repository. I cannot advise you about making changes because it depends on each repository.
However, using my Github example repository, I added a new Twitter account in the README file. Now you need to commit and push your changes, which you will do in the next step.
The first step is to add all your changes to the staging area. Basically, the add command includes your updates from a particular file in the next commit. It specifies what "to send to Github", in the simplest terms ever.
Run either of the following commands:
git add .
// or
git add README.md (your file name might differ)
git add . adds all your changes to the staging area. For instance, if you made changes in 10 files, it adds all those files. On the other hand, you can handpick changes by specifying the file name, as in the second version above. It only includes the files you specify.
You included the updates in the staging area, but now you have to commit them as well. Committing files means saving your updates to the local repository. Think of it as saving a Word document after making changes.
git commit -m "Added my name to the README"
You can see the git commit command in action above. The `-m' flag stands for "message", and it allows you to summarise your changes. That means you should describe what you did in the project. Try to make the commit messages as concise and descriptive as possible. At the same time, it does not mean you should write a novel.
The last step is to "push" the changes to the remote repository. Until you "push" your changes, they are only available in your local repository. That is, nobody can see them except yourself.
To push your changes, run the following command:
git push -u origin <your-branch-name>
You are almost done now! The next and last step is to create a Pull Request, which you'll see in the next chapter.
Figure 4
Suppose you followed all the steps from the seventh step - 7. Publish your changes - you should get a link in your terminal to open a pull request. Figure 4 (above) illustrates what you should see in your terminal.
If you do not get the same output for some reason, you can go to the repository URL > Pull requests tab > click on the Compare & pull request. See figure 5 below.
Figure 5
Whatever option you choose, a new window should open where you can create the pull request. Figure 6 illustrates that!
Be careful, though! Before submitting the pull request, make sure you read the contribution guidelines. At the minimum, add a descriptive title and description!
Figure 6
Click on the green button saying Create pull request, and you are done! All you have to do is to wait for PR comments. Well done!
By opening a pull request, other people can see the changes you've made to the codebase. Additionally, it allows other members to do a code review, which in turn might help you improve your skills and code. Thus, you can get valuable feedback!
Also, some changes might not be approved for various reasons, such as:
By creating pull requests, you protect the codebase from unwanted additions. Without pull requests, everyone can merge whatever they want to the main branch. Thus, the code quality will suffer.
In conclusion, pull requests helps and allows developers to:
Well done for learning the most basic Git workflow you can use to make OSS contributions. Also, well done for making your first open-source contribution if you followed the article!