Subscribe to our Premium Bi-Monthly WPTakeaway Newsletter by WPCouple! What is WPTakeaway?

Pull requests are the way of contributing or collaborating on a project on GitHub. Let’s say you want to contribute to a repository on GitHub, maybe fix a bug or a typo. Since you don’t own the repository, you can’t directly make the changes. So, what you do is, you simply make a copy/forkย of the repository, make changes, and create a pull request.

create a pull request

When you create a pull request, the owner of the original repository is notified that you have created a pull request and proposed some changes. The repository owner can review the changes, merge them, ask for a revision, or even discard them. This is how pull requests work on GitHub.


Ever wondered why it is called pull request, not push request? The reason is that you ask the repository owner to pull changes from your copy.

โšกย Steps to Create A Pull Request

According to our understanding of how pull request works, there are three basic steps to create a pull request:

  1. ๐ŸŽ— Fork the repository
  2. ๐ŸŽฌ Make changes in copy
  3. ๐ŸŽฏย Create a pull request

โ†’ Fork the Repository

To fork a repository, open the repository and click on the Fork button at the top left corner. For example, I am forking thisย Hacktoberfest repository by Ahmad Awais.

Forking a repository on git hub

โ†’ Make Changes in the Copy

Next step is to make the changes in the copy i.e fix the typo, bug, or whatever you want to contribute. You can either do it directly on GitHub โ€“ I will be doing in this guide โ€“ or you can clone the repo and push changes from your machine.

At the time of writing this piece, I just noticed that there’s a colon missing in front of a heading in this repo. So, I am going to propose a fix for it.

Making changes in the repo

Since it’s a minor fix, I can simply go ahead and edit the file on GitHub. However,ย I do notย suggest to edit files on GitHub for major changes in the repo. To do so, open the file in your copy of the repo and click on theย Editย button at top right corner.

Editing a file on GitHub repo

Clicking on the icon will open the file for editing. Make the changes you want to do and scroll down the screen. At the bottom, you’ll see a section namedย Commit changes. In this section, you provide the description and title of the proposed changes. Fill in the details and click onย Commit Changes button.

Adding details of the commit

Once you have clicked the Commit changes button, your changes will be saved in the file. Now, your copy of the repo is different from the original repository and you can create a pull request.

โšก Tips on Writing a Good Git Message by Ahmad Awais

  • Every Pull Request must have a title.
  • Every Pull Request must have a description.
  • Write the title and description of what you have done in the imperative mode, that is as if you were ordering someone.
  • โœ…ย DO: Start the line with “FIX“, “NEW“, “IMPROVE“.
  • โŒ DON’T: Start with “Fixed“, “Added“, “Adding“, “Improved“.
  • ๐ŸŽฏ Read โ†’ How to Write a Git Commit Message
  • ย Don’t end the summary line with a period – it’s a title and titles don’t end with a period.
  • ย Have fun. ๐ŸŽ‰

โ†’ Create Pull Request

Once you have made changes to the copy of a repository, the next step is to create a pull request. To do so, open the copy of a repository and click on the Pull Request option.

Creating pull request

It will show you a detailed comparison between the original repository and your copy. Modified files are displayed side by side where you can review your changes before you finally create pull request. Remember:

โœ… Green lines show the modified or newly added part of the file.

โ›” Red lines show the removed part of the file.

After reviewing the changes, click on theย Create Pull Request button at the top. It will open a new window asking you details about the pull request. By default, it picks up the commit message details.

Again, use the tips shared above to write a proper pull request message. Finally, click onย Open pull requestย button to create a pull request.

Opening a new pull request on GitHub

๐Ÿ”ฑ Sometimes the repository owner adds a code of conduct and contributing guidelines to create a pull request. In case, if there is any guideline by repository maintainer, make sure you follow that. It helps them quickly understand the pull request and review it.

For example, in the above pull request description, I answered a question in the description i.e What does a pull request do? โ€“ IMPROVE. It was a part of contributing guideline to easily understand the proposed change. That was all for it! If you have any questions feel free to ask in the comments below.

Peace.ย โœŒ



A Premium Bi-Monthly Newsletter by WPCouple! What is WPTakeaway?

There are currently no comments.

๐Ÿ™Œ You must have something to say here...