DEV Community

Cover image for How to Contribute to Open Source: A Step-by-Step Guide
Nabin Bhatt
Nabin Bhatt

Posted on

How to Contribute to Open Source: A Step-by-Step Guide

Hacktoberfest is an annual event where individual contributors come together to contribute to open source projects by adding new features, fixing bugs, improving documentation, etc.

You can earn cool swag or digital goodies as a reward, you typically need to make a certain number of contributions to any open source projects on platforms like GitHub during the month of October.

It's a chance to grow your skills, connect with others in the coding community, and have fun along the way!

Before we start, make sure you have;

🙌 Here's a step-by-step guide to contributing to open source:

Step 1: Choose a Project

Before you start, find an open source projects that interests you. It could be a tool you use, or something related to your field of expertise. GitHub is a popular platform for hosting open source projects, click here to search for projects that accepts contributions for hacktoberfest!

Step 2: Fork the Repository

On the project's GitHub page, click the "Fork" button in the top right corner. This creates a copy of the project in your GitHub account. Now you have to clone your forked repository to your local machine by entering the command below:

git clone
Enter fullscreen mode Exit fullscreen mode

Remember to change the project name and your-username in to above command. Then navigate to the project directory:

cd project
Enter fullscreen mode Exit fullscreen mode

Step 3: Create a Branch

Create a new branch to make your changes. This helps keep your changes isolated from the main project. To create a new branch, enter the following command:

git checkout -b your-feature-branch
Enter fullscreen mode Exit fullscreen mode

Step 4: Make Changes

Now, its time to make the changes you want to contribute. Maybe you want to add a new feature, fix a bug, or improve documentation.

Step 5: Commit Changes

Commit your changes to the branch you created in Step 3. Use the following commands:

# Add changes to the staging area
git add .

# Commit changes with a descriptive message
git commit -m "Description of your changes"
Enter fullscreen mode Exit fullscreen mode

If you are making multiple changes, you can repeat this step as many times as you want.

Step 6: Push Changes

Push your changes to your GitHub repository by entering the following command.

git push origin your-feature-branch
Enter fullscreen mode Exit fullscreen mode

This will transfer your commit(s) from local repository to remote repository (your GitHub account).

Step 7: Create a Pull Request (PR)

Go to your GitHub repository and click on the "Compare & pull request" button. Compare the changes and submit the PR (click on "Create pull request" button). Remember to write a title and description for your PR.

Step 8: Respond to Feedback

After you create a pull request, you can ask a specific person (maintainer) to review your proposed changes and be prepared to receive feedback on your pull request. Make necessary changes based on feedback until your contribution is accepted.

Step 9: Keep Your Fork Updated

Keep your forked repository updated with the changes from the original project. You can enter following commands in your terminal to do so:

# Add the original project as a remote
git remote add upstream

# Fetch changes from the original project
git fetch upstream

# Merge changes into your branch
git merge upstream/main
Enter fullscreen mode Exit fullscreen mode

Once your contribution is merged, celebrate your success! You've officially contributed to open source. Remember that contributing to open source is a learning process, and it's okay to ask for help or clarification.

Each project has its own rules, so be sure to read and follow the project's contribution guidelines (you can find in the project's repository).

Happy Hacking! 🚀✨

Top comments (2)

biplobsd profile image
Biplob Sutradhar

Great 👍

nabinbhatt profile image
Nabin Bhatt

Thank you <3