gh-pr
Create, view, and manage GitHub pull requests
TLDR
Create a pull request
Check out a specific pull request locally
View the changes made in the pull request for the current branch
Approve the pull request for the current branch
Merge the pull request associated with the current branch interactively
Edit a pull request interactively
Edit the base branch of a pull request
Check the status of the current repository's pull requests
SYNOPSIS
gh pr <command> [<args>...] [flags]
PARAMETERS
-R, --repo <HOST/>OWNER/REPO
Select another repository using the [HOST/]OWNER/REPO format
-h, --help
Show help for command
DESCRIPTION
gh pr is a subcommand of the GitHub CLI (gh), enabling seamless management of pull requests (PRs) from the Linux terminal. It supports workflows like creating PRs from local branches, viewing details, listing open PRs, merging with strategies like rebase or squash, applying reviews, and checking out remote PRs into git branches.
Designed for developers, it minimizes browser use by integrating with git. For example, gh pr create drafts a PR with title, body, base branch, and reviewers. Flags allow targeting specific repos via --repo.
Requires GitHub authentication (gh auth login) and git repository context. Handles draft PRs, labels, assignees, and milestones. Output formats include table, JSON via --jq on subcommands. Ideal for CI/CD, team collaboration, and power users. Supports GitHub Enterprise with --hostname (global flag). Regularly updated with GitHub features.
CAVEATS
Requires gh installed (<code>apt install gh</code> or similar), GitHub auth, and internet. Subcommand-specific flags/flags override globals; no offline mode.
COMMON SUBCOMMANDS
create: Create PR
view: View PR details
list: List PRs
merge: Merge PR
checkout: Checkout PR branch
QUICK EXAMPLE
gh pr create --title 'Fix bug' --body 'Details'
gh pr view 123 --web (opens in browser)
HISTORY
Part of GitHub CLI, first released Feb 2020 (v0.5.0) as open-source Rust tool by GitHub. gh pr evolved from early betas, adding subcommands like rebase-merge (v1.0+), review APIs (v2.0+). Now at v2.40+, mirrors web UI features.


