Skip to content

Checking PRs Locally

Wasila Dahdul edited this page Dec 8, 2023 · 2 revisions

You can check individual Pull Request (PRs) locally to view changes prior to merging. Essentially, you're fetching the PR as a new local branch. This page covers the CLI commands.

GitHub has a help page for checking PRs locally. The general syntax is

git fetch origin pull/ID/head:BRANCHNAME

A useful syntax to keep track of which PR is attached to which local branch is

git fetch origin pull/12345/head:pr12345

git checkout will move you to the branch to check it.

git checkout pr12345

git checkout main will take you back to the main branch.


We'll use as an example PR #71, which adds two new possible header images. This particular PR only adds the images, but doesn't actually change the html files to use those files. So, in order to check if we even want to use the images, we'd need to add extra editing locally.

This workflow would be

  1. update local repo
  2. run git fetch origin pull/71/head:pr71
  3. run git checkout pr71
  4. make changes to header-menu.html file
  5. run jekyll serve
  6. make changes to header-menu.html file again as needed to compare - jekyll should update on its own, so reloading the webpage in the browser should show an updated image without having to ctrl+c then rerunning jekyll serve. But, check the CLI output to verify the files are updated.

Most PRs won't require additional editing, and can be checked locally by the above workflow but omitting #s 4 & 6.