How to Contribute in Open Source Projects - Complete Tutorial

Published on 10/6/2024

Open Source ContributionEnglish Tutorial

Contributing to an open-source project can both be a valuable achievement and a fun experience for you. You can work on simple tasks, like fixing a button that isn't working in the UI, or broader tasks, like adding a whole new feature.

For example, you might know about VLC Media Player, right? But did you know it's an open-source project, also? All its code is available on GitHub, where you can contribute for free. Although it's not easy to jump straight into a pro-level project like this, being able to contribute to something so well-known is a great achievement, especially for a beginner.

alt text

Today, I'll show you how to start your open-source journey with some easy steps. Let's get started!

Prerequisite

  1. You need to have a GitHub account.

  2. Proper Git environment setup is a must.

  3. You’ll need VS Code or any other code editor set up.

  4. Optional: I recommend using GitHub Desktop for easier work.

Find a Repository to Contribute

How to find a good repository?

  1. First, you need to know a programming language or stack. For example, if you know JavaScript, you can search for JavaScript on GitHub and find related projects to work on.

alt text

  1. You can use these platforms to find projects you like:
    1. Hacktoberfest Projects
    2. Explore Github
    3. Up for Grabs
    4. Good First Issue : Make Your Fiest Open-source Contribution
    5. Get Started Contributing to Open Source Projects | CodeTriage
    6. Open Source Alternatives to Proprietary Software

After that, you can search for suitable projects and contribute to the one you think is right for you. Remember, it may take time to find a project you like at first, so be patient.

After selecting a project, take a good look at its README file or code, and learn about how the project works in detail.

How to know a repository is good to contribute?


Meets the definition of open source or not?

  • Does the repository have a LICENSE? Usually, there is a file named LICENSE in the main folder of the repository.

Project actively accepts contributions or not?

Check the commit activity of the main branch. You can find detailed information in the Insights tab on the repository's homepage on GitHub.

  • When was the last commit made?
  • How many total contributors are there for the project?
  • What is the commit rate like? (You can see this by clicking on "Commits" in the top bar on GitHub.)

Now, check the project's issues.

  • How many total issues are there?
  • Do the maintainers respond quickly when a new issue is opened?
  • Is there active discussion about the issues?
  • Are the issues recent?
  • Are the issues being closed after a specific time? (To see closed issues on GitHub, click on the "closed" tab on the Issues page.)

Do the same for the project's pull requests.

  • How many total pull requests are there?
  • Do the maintainers respond quickly when a new pull request is opened?
  • Is there active discussion about the pull requests?
  • Are the pull requests recent?
  • Are the pull requests being closed after a specific time? (To see closed pull requests on GitHub, click on the "closed" tab on the Pull Requests page.)

Project is welcoming or not?

You can tell if a project is friendly or welcoming by looking at how the project maintainers treat new contributors.

  • Do the project maintainers respond helpfully to questions about issues?
  • Do they behave friendly in issues, discussion forums, and chats (like IRC or Slack)?
  • Are the pull requests reviewed?
  • Do the project maintainers thank developers for their contributions?

Today, we have taken a project called Invoice-Generator as an example for beginners. I hope you'll choose even better projects in the future!

Finding the Perfect Issue

You can go to the issues tab to see what issues are there and try to solve them. As a beginner, try to fix an easy issue. You can also explore the entire project on your own to find a new issue and solve it.

alt text

For example, this project has a calculation issue where adding two or more items doesn’t give the correct total price. Only the price of one item is being added. So, we can work on fixing this issue.

alt text

Understand and Validate the Issue

First, don't jump straight into fixing the issue. Go step-by-step. Make sure you can resolve the issue and that it is valid.

Since this issue hasn't been created yet, we will create it first. To do this:

  1. Create a new issue.

alt text

  1. Provide the title and description with details (including a screenshot of where the issue is happening, if possible).

alt text

alt text

  1. Write a basic document explaining what I expect as a solution and then submit the issue.

alt text

alt text

The issue has been created. Now, I will ask for permission to be assigned to work on it. I need to go to the issue I created and add a comment.

alt text

alt text

If the maintainer assigns it to me, I can work on it, and no one else can work on it.

Now, I will wait until I get assigned (Professionally, I should wait).

Fork and Start Contributing

  1. When I get assigned, I will start working. First, I will fork (copy) the main repo to my account since I don’t have access to the original repository. Then, I will start working on my copied repo.

  2. Now, clone the project to own device using Git clone or GitHub Desktop.

    git clone https://github.com/johnuberbacher/invoice-generator.git
    
  3. Go to the folder : cd invoice-generator

  4. To contribute choose the parent project.

alt text

  1. Open the project in VScode.

  2. Now, check the repo's README and look for the contribution guidelines. Follow those guidelines to start working.

alt text

alt text

alt text

alt text Fig: Project is running perfectly in localhost:3000

I have set up the project in my environment, now let’s start working.

You don’t need to understand the whole codebase to resolve an issue. Just check the project from the outside to find an issue, then look at the specific code related to that issue to see if you can work on it.

For example, I checked the invoice generator code and found out why the prices for multiple items are not adding up. After checking, I found the problem in two functions in the InvoiceForm.js file: handleAddEvent(evt) and handleCalculateTotal().

After coming up with my own solution, I will definitely check if the whole project runs correctly. (Obviously, I won't share the solution here.)

alt text

alt text Fig: Project is running perfectly

I will go to the project terminal and add my changed code. Since I only changed one file, I will add just that file.

alt text

Now, I will make a commit in Git.

alt text

Linking PR with Issue

Now I will add my contribution to the main repo. Here are the steps shown in screenshots:

alt text

alt text Fig: Mentioning issue no. in description of pull request is a must

alt text

alt text

alt text

Wait for the Maintainer to Merge

Now you need to wait until the project owner reviews your code and merges it. If your code is not accepted (merged), don't be upset. Congratulations on your first work in open-source projects!

Note: I haven't shown any work that you can list as a professional achievement on your CV. My goal is to help you understand how to get started as a beginner. To improve and work better, you will need to explore and learn more on your own. Best of luck on your open-source contribution journey!

Resources :


  1. Open Source Crash Course - Beginner Guide to Open Source
  2. First Contributions - Github
  3. How to Contribute to Open Source
  4. Build Successful Open Source Projects : use this to track and see your open source contribution dashboard
  5. Top Hacktoberfest Projects to Contribute to in 2024

image.png

image.png

FacebookTwitterLinkedInYouTube


⛑️ Support Our Mission

If you find this guide helpful, consider A Small Donation to support our efforts.


Views: 0

Comments (0)

    Subscribe or follow me
    N
    Join me as I explore new things and document the little moments that make up my journey.
    Follow us
    2024. Made with ♥ by Someone Special