DEV Community

Cover image for How to Create Pull Requests on GitHub to Suggest Code Changes
Ranjali Roy
Ranjali Roy

Posted on • Originally published at zepel.io

How to Create Pull Requests on GitHub to Suggest Code Changes

When you think of GitHub, the words that are most likely to pop up in your head are collaborative coding.

In the eyes of its founder, GitHub was created to help developer teams to collaborate with each other on the same piece of code without stepping on each other’s toes.

And an integral aspect of this collaboration with fellow developers is to have the ability to suggest changes to the code.

These changes get reviewed by a teammate. And then, they are pulled and merged into the corresponding branch by the reviewer.

By suggesting changes rather than allowing them to be made directly, chaos is avoided. Because when two or more developers are collaborating on a piece of code, unless each one knows the logic behind it, making direct changes can have grave consequences.

Having had a quick understanding of the ‘what’ and the ‘why’ of creating pull requests, let's get to the 'how' part, shall we?


Before You Begin

There are two things you need to check for before you create a pull request.

  1. Selecting the destination repository and branch
  2. Permissions

Selecting the destination repository and branch

You must be familiar with repositories and branches in github by now.

And so, you would know that the best practice while working on your code is to create separate branches and make changes to them before pushing them into the master branch. This way, only the final version of the code gets pushed into the master branch.

Since by default the pull requests are created based on the repository’s default branch, select the appropriate destination repository and base branch before suggesting changes.

The base branch is the branch you want the changes you suggested to be reflected on. You must also select the compare branch, the branch you make your suggestions in.

Use the drop-down to switch to the right repository and corresponding branches.

Permissions

You require read permissions to a repository to create a pull request while write permissions are needed to create a branch.

Depending on the permissions you hold to the destination repository, here’s how you can go about it:

  1. Creating a pull request
  2. Creating a pull request from a fork

How to Create a Pull Request in GitHub

Once all the prerequisites are set, you can jump straight to creating your first pull request using the following steps:

  1. Open the main page of your repository on your GitHub account in your browser and click on the Pull requests tab.

Alt Text

But if you’re using the desktop app, go to Branch -> Create a pull request and follow the steps mentioned below.

Alt Text

Note: Regardless of whether you use the desktop app or the browser, the ‘Create pull request’ page will open in your browser only.

  1. Now, click on the New pull request button.

  2. Choose the appropriate base branch and the compare branch and click on Create pull request.

Alt Text

  1. Enter a suitable title and description for the pull request.

Note: the title is usually auto-filled with the branch's name and the description has the list of all commits that were performed in that branch.

And with that, you would have successfully created your first pull request to be reviewed by your teammates.


How to Create a Pull Request from a Fork in GitHub

Forking in GitHub is a handy feature when you don’t have the necessary permissions to access the repository in which you wish to suggest changes and you don’t want to waste your valuable time waiting for it.

Once you’ve made changes to your forked repository, you can suggest to push them into the original repository using the following steps:

  1. Open the main page of the original repository that you created a fork for.

  2. Navigate to the Pull requests tab above the files displayed.

  3. Now, click on compare across forks on the page that appears.

Alt Text

  1. Using the respective drop-down menus, select the base repository and base branch to select the destination repo and branch you want the changes to be merged to.

  2. Also, select the forked repo using the head repository drop-down menu and the correct branch with the suggested changes using the compare branch drop-down.

Alt Text

  1. Click on Create pull request and give your pull request an apt title and description.

Now, your changes are ready to be reviewed and approved by your colleagues.


GitHub is every developer’s right hand and we understand that better than anybody else. That’s why we’ve deeply integrated GitHub with Zepel.

Now you can concentrate on doing what you love - building quality software while we take care of the humdrum routine work of updating your progress for you.

All you’ve got to do is use Zepel’s suggested branch name when you create a new branch.

Alt Text

Going one step further, you can link your Slack to Zepel and get real-time notifications of your team’s progress updates.

Alt Text


Try Zepel for free and leave it to us to keep your team in the loop regarding your progress updates. Check out why 4000+ teams prefer it over others.

If you're not fully convinced, see how Zepel compares to other agile project management tools.

Top comments (0)