Title: Checking out a Github Pull Request on the command line
Author: Alex Kirk
Published: October 6, 2022
Last modified: October 26, 2023

---

# Checking out a Github Pull Request on the command line

October 6, 2022

Loving this alias (requires `brew install gh`):

    ```wp-block-code
    pr() {
            git fetch
            gh pr checkout $*
    }
    ```

It will switch to the right git branch based on the PR number like this: `pr 45`
will switch to the branch of pull request 45 of that github repo

###### Fediverse reactions

[Code](https://alex.kirk.at/category/code/), [Workflow](https://alex.kirk.at/category/workflow/)

[git](https://alex.kirk.at/tag/git/)

Read this next

[Previous Post](https://alex.kirk.at/2022/10/05/1270604/)

![Alex Kirk](https://alex.kirk.at/wp-content/uploads/sites/2/2025/06/cropped-2025.
Alex-512x512-1-120x120.jpg)

Alex Kirk

@alex@alex.kirk.at

 **273** posts

 **284** followers

### Leave a Reply 󠀁[Cancel reply](https://alex.kirk.at/2022/10/06/checking-out-a-github-pull-request-on-the-command-line/?output_format=md#respond)󠁿

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Δ

This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/)