A Simple Pull Request on GitHub

Hi all… Learning has become an essential thing in our lives. As we are more techy people , we have to learn new technologies every day and keep updated as much as we can.

Specially, If we are trying to learn a new technology, it’s a great idea to practice our skills by contributing to a project on GitHub that uses that technology.

To do that we should know how to interact with the project. Simply this includes how to collaborate to the project and send bug fixes, how to make sure that your fixes are applied, and even how to figure out which fixes are needed.

In GitHub we can look at other people’s codes to learn and collaborate with them. But we are restricted to edit a file in a project that we don’t have a right access to. But , we can fork a project to our GitHub account of the project where we can commit our changes to. when we submit changes to this file, it will create a new branch so that we can send a pull request.

But what exactly is a fork?

Forking is a way of creating a copy of the given repository so that it belongs to that specific person who owns the repository. But the person who is going to contribute to the project is able to push changes to the forked copy, even when that person can’t push changes to the original repo.

So the typical workflow of contributing a GitHub Project is given below.

1.create a fork of the repo, and then work on that local fork.

When you go in to the repository that you want to contribute , in the upper right corner there is a button as given in the image

A forked repo is just like a normal repo, except GitHub knows which repo it forked from. So we can eventually merge our changes back into the main repo by creating a pull request.

2. Do the changes or the fixes related to the codes

Now you can do changes on the forked repo and make a change proposal.

This will create a commit in the forked repo. So as we discussed earlier , it will send the changes in a branch. Then we can compare the changes too. To merge it to the main repo , we need to create a pull request.

3. Create a pull request by clicking the Pull request button

Click pull request button as given the image

After clicking, we will get a text box to write about our changes. After that we should make the pull request.

Since a pull request is a commit or series of commits that you send to the owner of the repository so that they incorporate it into their tree , the owners of the repo will review the changes before merging them. Checking that they match the development guidelines for the project and that the license is valid and so on.

4. Owner decides  whether they want to merge it to the project or not.

Then the owner/owners of the repository will decide whether they want to merge this changes to the main branch. Accordingly it can be merged or discard.

So this overall process is done through the GitHub interface. With this knowledge we can start contributing to projects on GitHub.

Enjoy!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store