You Should Know this GitHub Feature Right Now | Part 2

You Should Know this GitHub Feature Right Now | Part 2

In the Article Understanding GitHub, in a Nutshell, we learned about the basics of using GitHub like creating Repositories, Forking other repositories. Let's take it further and see some more functionalities and features which we can do in GitHub. We shall be learning how to contribute to a Repository, how to make Pull and Push requests.

GitHub Pull and Push Requests

                So, The way by which we can contribute to an open-source technology is by pull and push requests, first, let's understand what does this actually means. In the last article, we learned how to fork others' but we also know that making changes in the copy of the repository which not affect the original repository. So the pull and push requests come into the picture now. Whenever a developer of the repository wants help on a specific part of the code he makes a pull request. We can find these requests on GitHub, If we can solve the problem by modifying the code we can make a push Request to the developer. After this, he reviews the code and decides whether to merge it with a main/master branch or any other branch.

How To Make A Pull Request?

                Let's understand this with a Simple Example, I made a Repository last time name myFirstRepo, Now let's make pull and push requests. To start these let's fork the Repository for which we want to contribute, After forking the repository and editing the code, we need to make a push request.

                This process cant be demonstrated by one account so, I requested one of my friends to make a contribution to the Repo. So as we can see My friend has forked the Repo and also modified the code. Now if he wants to make the changes reflect in the original repository then he needs to make a Pull Request as we see in the above Image by Clicking the Contribute Option.

                We can see that he just added a new line "print("After Editing")" so when we click on Open pull request we will be able to see the changes made by them. 

Then we need to click on Create a Pull request which will send a request to the Developer of the Original Repository. We can see a Notification in the Pull request tab of the page.

Then it depends on the Developer whether to merge it with the branch or not. 

What is a GitHub Branch?

                GitHub Branches are yet another important aspect. Branches can be considered as different versions of this software, there can be many branches like a master, main, development, production. We can use Branches in such a way that all the world is using the production branch, developers are working on the development branch, and The main software is in the master branch. It is always recommended not to make a pull request in a master branch because the master branch contains all the major software codes, and if your modified code has some bugs then it might affect the software or application.

                So now we can add the modified code into the master branch as this is only for demonstration. Then we can see the changes are being reflected on the Main Repository. and The Code is merged with the Repository. One more thing we can notice here is that In the Main Repository under the contributor's tab we can see that my friend is also being added as he contributed some part of the code. In this way, we can contribute to Open Source Technologies.

How To find the Right Repository To Contribute?

                Finding the Right Repository to contribute to is also a hard task, but Github makes our lives easier by one of its features, Let's see how to do so. Login to your account and go to the homepage, now you can see an option like Pull Request click on it.

                Here we can search for the repositories based on experience level, Language or framework used, etc. This is a really powerful tool and you can find the right Repository. This Search option can be used with options and commands one example is. is:open is:issue language:python label:"good first issue" Here we can see we are searching for pull requests which are open and using python language. We are also mentioning Good First Issue which means it is good for beginners, then we can see a bunch of pull requests by developers around the world, we can select any one of them and start contributing to it.

                We can also see that apart from the good First issue label other labels describe the pull request more briefly like whether it is using any framework, whether it is backend or frontend work etc. After finding the Right Request we can fork the Repo and start working on it, After completion, we can make a pull request which will be verified by the developer of the Repo, and merges it with the main branch if he feels satisfied with the changes.

In this way, we can contribute to Open Source Technologies Using GitHub.

Post a Comment

Previous Post Next Post