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

[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/)

### 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)󠁿

Only people in [my network](https://alex.kirk.at/friends/) can comment.

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