How to Make A Pull Request on GitHub

Hongtao Hao / 2020-10-05


I learned how to contribute via making a pull request from the contributing guidance by Victorial Drake

Step1: For a repo #

Reference: Fork a repo from GitHub Docs

Forking the original repository #

Simply fork the project you would like to work on. For example, I forked Professor YY’s covid19-data . Here is what the fork looks like.

Making a local clone of your fork #

In Terminal, first navigate to the directory where you want to place this local clone. In my example, I’ll put it on my Desktop. Then, git clone your fork.

cd Desktop
git clone https://github.com/hongtaoh/covid19-data

Syncing your fork with the original repository #

The original repository is also called the upstream repository.

First, change directories to the location of your fork. Continuing with the above code, I’ll type:

cd covid19-data

Before adding the upstream URL, let’s first check the current configured remote repository for our fork1:

$ git remote -v
# It gives me the following results
> origin	https://github.com/hongtaoh/covid19-data (fetch)
> origin	https://github.com/hongtaoh/covid19-data (push)

Go to the upstream repository, copy its HTTPS location (in my case, it is https://github.com/covid19-data/covid19-data.git), and

git remote add upstream https://github.com/covid19-data/covid19-data.git

Now type git remote -v again, and you’ll see the change:

$ git remote -v 
> origin	https://github.com/hongtaoh/covid19-data (fetch)
> origin	https://github.com/hongtaoh/covid19-data (push)
> upstream	https://github.com/covid19-data/covid19-data.git (fetch)
> upstream	https://github.com/covid19-data/covid19-data.git (push)

Step2: Make changes to your fork #

After making changes to the local clone, you can push the changes to your fork.

# First change directory to your local clone
git add .
git commit -m "Description of your changes here."
git push

Then, I can see changes in my fork .

Step3: Creating a pull request from your fork #

See details here .

What to do before sending your pull request #

Victorial Drake suggests opening an issue telling people what changes you are going to make before sending the pull request. This is because if others don’t think your changes are necessary, then you don’t need to send it in the first place.


  1. Please note that $ and > are for demonstration only and you aren’t supposed to type them in your Terminal. $ is followed by what you want to type in Terminal, and > is followed by the results from Terminal. ↩︎

Last modified on 2020-10-07