DEV Community

Subhajit Shaw
Subhajit Shaw

Posted on

How to Contribute to Open Source as a Beginner

Contributing to open source might seem intimidating when you’re just starting out. You may think that you need to be an expert or you should know the entire codebase but that’s far from reality!
In this guide, I’ll walk you through everything you need to know to make your first open source contribution, even if you’ve never contributed to any project before.

Before we dive in, make sure you have:

  • A Github account

  • Visual Studio Code installed in your computer (download here)

What is Open Source and Why Contribute?

Basically Open source refers to projects whose source code is freely available for anyone to view, modify, and distribute. It’s built collaboratively by developers from all over the world.

There are benefits of contributing to open source

  • Learn real-world coding practices.

  • Build a strong portfolio

  • Improve your problem-solving skills.

  • Collaborate with developers globally.

As you’re a beginner, participating in programs like GirlScript Summer of Code (GSSoC) and Hacktoberfest is a great way in getting started. These events encourage contributions from beginners and provide mentorship and guidance, do check those out.

Finding Beginner-Friendly Projects

One of the best ways to start is by finding repositories with beginner-friendly issues. If you participate in GSSoC or Hacktoberfest, you can easily get the available projects list in their discord server. From there, you could easily search for beginner-friendly projects that match your expertise and tech stack.
Look for labels such as:

  • good first issue

  • easy

  • beginner

Tip: You can also create issues yourself! If you spot a bug, broken link, UI issue, or even documentation errors while exploring a project, open an issue describing it. Maintainers often welcome such contributions. You can also request new features by opening an issue and clearly describing your idea or use case.

Reading a Project’s Documentation

Before making changes, always familiarize yourself with the project’s guidelines:

  • README.md: This gives an overview of the project, setup instructions, and usage.

  • CONTRIBUTING.md: Know step-by-step process for contributing.

  • CODE_OF_CONDUCT.md: Expected behavior while engaging in the community.

These documents will help you understand how the project is structured and how you can contribute effectively.

Making Your First Contribution

Once you’ve been assigned an issue, follow these steps:

1. Fork the repository

  • Click the Fork button on the top right of the repository’s GitHub page to create your own copy. fork button

2. Clone the Repository

  • Now, open an empty folder in VS Code and run this command in the terminal.
git clone https://github.com/your-username/repository-name.git
Enter fullscreen mode Exit fullscreen mode

Replace your-username and repository-name with your actual GitHub username and the name of your forked repository, respectively.

3. Navigate into the project folder

cd repository-name
Enter fullscreen mode Exit fullscreen mode

4. Create a new branch

  • You can name it anything you want, but it's best to keep it meaningful, it's usually named after the issue you're working on.
git checkout -b your-branch-name
Enter fullscreen mode Exit fullscreen mode

5. Make the Changes

  • Fix the issue assigned to you (UI, documentation, bug fix, etc.).

6. Stage and Commit Your Changes

git add .
git commit -m "Description of your changes"
Enter fullscreen mode Exit fullscreen mode

7. Push Your Changes to GitHub

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

8. Open a Pull Request (PR)

  • After you've successfully pushed your code, go to your forked repository. There, you'll see a "Compare and Pull Request" button.

Pull request

  • Now submit the PR with a clear description.

9. Handling Merge Conflicts

  • If someone else’s PR modifies the same file you worked on, you may face merge conflicts.

  • First, add the original repository as an upstream remote:

git remote add upstream https://github.com/original-owner/repository-name.git
Enter fullscreen mode Exit fullscreen mode
  • Pull the latest changes from the upstream main branch:
git fetch upstream
git rebase upstream/main
Enter fullscreen mode Exit fullscreen mode
  • Resolve conflicts manually in VS code, then:
git add .
git rebase --continue
Enter fullscreen mode Exit fullscreen mode
  • Push your updated branch:
git push origin your-branch-name --force
Enter fullscreen mode Exit fullscreen mode

10. Wait for Review

  • Be open to feedbacks from maintainers

  • Once approved your changes will be merged

Yay! You made your first contribution! Take a moment to celebrate you’ve officially joined the open source community and taken your first step towards making an impact in the developer world.

If you found this blog useful and insightful, share it and comment down your views on it.

Do follow me for more such content.

If you have questions, want to collaborate, or just want to share your open source journey, feel free to reach out.

Top comments (0)