Open a pull request on GitHub

You can open a pull request when you want to integrate changes made on one branch into another branch. Usually this happens, when you or a collaborator made some changes in a separate branch and those changes should now be merged into the main branch.

The advantage of a pull request in comparison to a simple merge is that it can first be commented and reviewed by the collaborators before the changes are accepted.

Let’s say you created a new branch called add_cookies, made some changes and pushed the branch to GitHub. If you now open your remote repository website, GitHub automatically detected this branch and ask you to create a pull request for it.

It should look something like this:

Click on Compare & pull request.

Now is the time to describe your changes to your collaborators, so they can understand what you did. Add a title and description for your pull request. This can become quite a long text (sometimes even with screenshots attached) if you made lots of changes that you need to explain. When you are finished click on Create pull request:

Now your collaborators get notified of the pull request and can browse your code and make comments.

Under the “Conversation” tab, you and your collaborators can make comments and discuss the changes. To see how it looks like, make a comment yourself.

On the top, you can also navigate to Files changed and see all the changes that are introduced to the project in this pull request:

In the “Files changed” tab, you can select single or multiple lines of code and add comments to it.

Just explore the functionality of pull requests a bit by yourself.