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.
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.
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.
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
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.
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.
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)