So… What is a Pull Request?!

Olesya Miller
3 min readMay 18, 2021

Hi everyone! It’s Monday, and that means it’s time for my weekly blog post! Today I have decided to write about pull requests, mainly because I myself need to improve my version control skills. All right, what is a pull request?A pull request is basically submitting code contribution to an ongoing project where you are not a sole developer.

If you go to GitHub and find someone’s repository and you see something you want to change or add to. A pull request allows you to request the owner of that repository pull in your new changes in order to fix the problem.

For example, I’m going through the repository and I see there is a word misspelled. The first thing to do when creating a pull request is to fork the repository which allows you to create a brand new copy of the repository on GitHub cloud. Once you have done that, you own the copy and you can modify the code without affecting the master branch of the project.

The next step would be to clone the repository on your local environment. Now you are free to make changes. For example, if you want to fix a typo in a READ.me file. Since we are making a pull request we have to create a new branch which we will share with the owner of the repository

git checkout -b fix-readme-typo

Now we have to get on our new branch

git checkout fix-readme-typo

And to make sure we are on a right branch we have to run this command

git branch

And we get

main 
* fix-readme-typo

The asterisk new the branch means we are currently on that branch.

After making changes to the file and saving it we can run

git status 

which show us what file has been modified.

To see the differences we can type

git diff

and we get the initial version of the code and the new one.

Next, we obviously have to add, commit and push the changes. And now if we go to our GitHub we see that a new branch has been created and there is a green button next to it that says ‘compare and pull request’

When we click that button what it does is it asking if I want to take my new branch on the left and put it in a test repository on the right

Now our pull request is in the ‘pull requests’ tab and the owner of the repository can review our changes and decide if they want to accept them or not! How cool is that?!

I hope you guys found my post useful.

Happy coding!

--

--