GitHub Pull Request Workflow

GitHub pull request drawing

There are enough steps in the GitHub pull request workflow that I wrote them down for reference.

Fork a Project

To fork a project, just go to the GitHub project page and click “Fork”. You'll need a GitHub account, and to be logged in for this to work. GitHub will create a fork of the upstream project in your account.

Then you'll need to clone the project so that you have a copy of it checked out on your computer:

git clone

Change directories so that you’re at the root of the checked out project directory:


Track the upstream repo:

git remote add upstream \

Verify the new remote named “upstream”:

git remote -v

Update Fork From Upstream

Fetch upstream updates:

git fetch upstream

View all branches:

git branch -va

Merge “upstream” into our main branch:

git checkout main
git merge upstream/main

Feature Development / Bug Fix Cycle

Switch to the “main” branch, as the source of our new feature branch:

git checkout main

Create the new feature branch and check it out as our local copy:

git branch NEWFEATURE
git checkout NEWFEATURE

Add your new feature or bug fix here...

Fetch upstream main branch and merge into our main branch:

git fetch upstream
git checkout main
git merge upstream/main

If there were any new commits, rebase development branch:

git checkout NEWFEATURE
git rebase main

Push local feature branch to remote feature branch:

# the first time you have to set it as the upstream branch
#git push --set-upstream origin NEWFEATURE
git push origin NEWFEATURE

Create pull request. Go to the GitHub page for the feature branch and click “pull request”.

The pull request gets accepted or rejected.

Delete feature branch once accepted:

git push origin --delete NEWFEATURE
git branch -d NEWFEATURE