DEV Community

Cover image for Opensource Contribution
ShUbHaM13M
ShUbHaM13M

Posted on

Opensource Contribution

This is a guide to get started with Opensource contribution on Git. In order to contribute to a repository on Git we first have to create a fork of the repository in our personal Git space.

The project that I will work on is a Chat application. I will work on adding the functionality to support rendering links and opening the URL in another tab, currently it just renders it as a text.

Fork git repo
Forking the repo

Naming the repo
Naming the repo

The name of the repo doesn't have to be the same as the original repo

After creating a fork we can clone the repo. I am cloning the repo using SSH.

Cloning the repo
Cloning the repo

Next we have to add another remote to the cloned repo. This remote is the repo URL of the original author of the repo. Using this remote we can sync the cloned repo to the latest changes. I have used the HTTPs URL in this case as I only have read access to this repo.

Adding remote to the original repo
Adding remote to the original repo

Usually I will just name it same as the author's name

We can check if adding the remote was successful using

git remote -v
Enter fullscreen mode Exit fullscreen mode

Next up we can just pull from the original repo, just to get the latest changes if any before continuing. It is a good idea to stay up to date with the original repo to prevent possibility of merge conflicts.

In order to work on a new feature create a new branch and add the changes and updates in this branch, commit and then push the changes.

Creating a new branch
Creating a new branch

These changes are only going to be pushed on the forked repo in our workspace as we don't have the write access to the original repo anyways.

After working on the feature and pushing to the forked repo we can send a pull request to the original repo, adding a descriptive message to the changes made.

Creating a pull request
Creating a pull request to the original repo

Leaving a descriptive change log for the author
Leaving a descriptive change log for the author

The author can then review the changes, and merge the pull request.
That's the basic of contributing to a repository on Github, Gitlab or any other VCs.
Make sure to also go through the licensing of the repositories.

Top comments (0)