Contributing to the GitHub project

We have just looked at how to create a repository on GitHub. However, what we need to know is that, by default, only the owner of the repository is allowed to modify the code of this repository.

We can add people as collaborators to this repository so that they can make changes to the code. For more information about this procedure, please go to https://help.github.com/en/articles/inviting-collaborators-to-a-personal-repository.

With the help of this principle, we don't have the right to modify the code of another repository.

To contribute to the code of another repository, we will need to create a fork of the initial repository that we want to contribute to. A fork is a duplication of the initial repository that is performed in our GitHub account, thus creating a new repository in our account.

Follow these steps to learn how to create a fork of a repository:

  1. First of all, let's navigate to the initial repository that we want to contribute to.
  2. Then, click on the Fork button at the top of the page, as shown in the following screenshot:

  1. After a few seconds, this repository will be forked and duplicated with all its content in our account. By doing this, we get a new repository in our account that is linked to the initial repository, as shown in the following screenshot:

  1. Now, we have an exact copy of the repository that we want to contribute to in our GitHub account. We are free to modify the code and make commits of our changes, all of which will be archived in our repository.

However, even if there is a link between the initial repository and the fork, the code for each repository is completely uncorrelated and there is no synchronization of the automatic code.

In this section, we've discussed the steps we need to take to create a GitHub repository or to make a fork of another repository so that we can contribute to it. We will now look at how to propose code changes and merge our code into another repository using a pull request.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.132.214