DEV Community

Cover image for Start Contributing On Open Source Projects
Abdelrahman AbouDeghedy
Abdelrahman AbouDeghedy

Posted on

Start Contributing On Open Source Projects

Recently, I tried to enter the open-source world, and contribute on GitHub. After doing some search and experimenting with one of my friends, I figured it out, and I will try to demonstrate it as easily as possible.

First of all, I will go with the installation guide for Git Bash, and explaining some common git terms.

  • Git Bash Installation.
  • Forking.
  • Issues.
  • Pull Requests.
  • Adding & Committing.
  • Steps To Make a Successful Contribution.

Git Bash Installation

Git Bash is essentially a terminal, where you can implement git commands on.

You can download git bash from here, and choose the appropriate operating system that works for you.

Issues

According to GitHub Guides, “Issues are a great way to keep track of tasks, enhancements, and bugs for your projects.”

On any open-source project, navigate to the issues tab, and choose an open issue that you can solve.

Before working on any issue, you should add a comment to request solving it, then solving, after the owner of the project assigns it to you.

issues

Forking

According to GitHub Docs, “A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.”

Pull Request

This is the core feature of collaborating.

After fixing the issue, you make a pull request, that suggests adding your fix to the project, and the project owner will review it, and respond to you.

If he accepted it, he will merge your fix with the project.

Commit Message

It’s a message that describes the changes that you did.

When you work on solving an issue, your commit message should include the number and the name of the issue.

Adding

After making any changes to your project, you should add it first to what’s known as “Staging Area” before committing it. The details of the staging area are not important to complete this process.

Pushing

This is the operation in which we push our changes from our local repo, to the remote one.
It’s used to make the remote repo in sync with our local one.

Steps To Make a Successful Contribution.

Configuring your info.

This is a mandatory step, so that the commit message that you will make, will have an author.

git config --global user.name "Your name"
git config --global user.email "Your Email"
Enter fullscreen mode Exit fullscreen mode

Fork the Repository.

On GitHub, on the top right corner, press the fork button.
Fork

Clone the Forked Repo.

On GitHub, press the green button, and copy the cloning link.

git clone [the url copied from the remote repo]
Enter fullscreen mode Exit fullscreen mode


Clone

Making a New Branch.

Make a new branch to your local repo, so we can make changes to the project inside this branch, and later we will ask the project owner to merge our branch with the main branch of the project.

The best practice is to make the branch name the same as the issue name.

git checkout -b [Your branch name]
Enter fullscreen mode Exit fullscreen mode

Setting an Upstream.

We set up an upstream so that when we push our changes later, the default destination to push into will be our new branch.

git push -u origin [Your Branch Name]
Enter fullscreen mode Exit fullscreen mode

Making Changes to the Files Locally.

Make the required changes to the project, that solve the issue.

Checking the State of Your Files.

This is an optional step, that shows the modified files (locally).

git status
Enter fullscreen mode Exit fullscreen mode

Adding the Changes, then Commit them and Writing a Commit Message.

To add the changes, we do the following:

git add * 
Enter fullscreen mode Exit fullscreen mode

The * means add all the changed files, you can replace it with any file name that you changed before.

To commit a change, we do the following:

git commit -m "Your Commit Message"
Enter fullscreen mode Exit fullscreen mode

Pushing our Changes to Our Forked Remote Repo.

git push
Enter fullscreen mode Exit fullscreen mode

Making a Pull Request.

When you open your GitHub forked repo, you will find this message pops up.

Click on Compare & pull request to make a pull request, then add your comment, and press create a pull request.
pull request

That's it. Congratulations on your first pull request! I hope this post was helpful for you, and helped on your open source journey. Good Luck!

Top comments (0)