LinuxCommandLibrary

git-pr

Create GitHub pull requests from the command line

TLDR

Check out a specific pull request

$ git pr [pr_number]
copy

Check out a pull request from a specific remote
$ git pr [pr_number] [remote]
copy

Check out a pull request from its URL
$ git pr [url]
copy

Clean up old pull request branches
$ git pr clean
copy

SYNOPSIS

git-pr <subcommand> [<options>] [<args>]

PARAMETERS

create
    Create new pull request from current branch

list
    List open pull requests (optionally filter by state/user)

view <number>
    View pull request details in browser

checkout <number>
    Checkout pull request branch locally

merge <number>
    Merge pull request (with options for squash/delete)

-t, --token <token>
    GitHub API token for auth

-r, --repo <owner/repo>
    Target repository

-b, --base <branch>
    Base branch for PR

-h, --help
    Display help

--version
    Show version

DESCRIPTION

git-pr is not a core Git command but a popular third-party tool or alias for streamlining GitHub pull request workflows. It simplifies creating, viewing, listing, checking out, and merging pull requests directly from the command line, often integrating with the GitHub API. Unlike core Git's git request-pull, which generates plain-text email summaries of changes, git-pr handles interactive browser flows, assignees, labels, and reviews.

Typically installed via npm (npm i -g git-pr), pip, or as a Git extra/script. It requires GitHub authentication (often via token or SSH). Usage assumes a remote named origin pointing to GitHub. Common in developer setups for faster PR management without leaving terminal. Variants exist (e.g., from GitHub repos like tj/git-pr or others), so exact features vary—check git-pr --help or repo docs.

Enhances productivity in CI/CD and team collab but depends on hosting platform support.

CAVEATS

Not standard; requires installation and GitHub auth. Behavior varies by implementation/version. May conflict with Git aliases.

INSTALLATION

npm install -g git-pr
or git clone https://github.com/... && make install

AUTH SETUP

Set GITHUB_TOKEN env var or use gh auth login integration.

HISTORY

Emerged ~2013 as community tools for GitHub CLI gaps. Popularized via npm/pip packages; evolves with GitHub API v3/v4.

SEE ALSO

git(1), gh(1), hub(1), git-request-pull(1)

Copied to clipboard