gh-pr-view
View pull request details
TLDR
View the pull request associated with the current branch
View a specific pull request
Open the pull request in the default web browser
Show comments in the terminal
SYNOPSIS
gh pr view [<number | url | branch>] [flags]
PARAMETERS
--body
Include the pull request body in the output
--comments
Include review comments in the output
--json fields
Print JSON output using specified fields (e.g., url,title,body)
--jq expression
Filter JSON output using a JMESPath expression
--template string
Format JSON output using a Go template
--web
Open the pull request in the default browser
-R, --repo [HOST/]OWNER/REPO
Select another repository using the [HOST/]OWNER/REPO format
DESCRIPTION
The gh pr view command, part of the GitHub CLI, displays detailed information about a pull request (PR) in the terminal. It shows the title, state, number, URL, author, labels, assignees, milestone, and draft status. By default, it targets the PR associated with the current branch if no argument is provided. The body is included unless suppressed.
This tool is ideal for developers reviewing PRs during workflows without switching to a browser. Output can be customized with JSON for scripting, or comments/reviews for full context. Use positional arguments like PR number, full URL, or branch name to specify the target PR.
For repository-specific views, pair with --repo. It integrates seamlessly with Git, assuming the repo is cloned and gh is authenticated.
CAVEATS
Requires GitHub CLI authentication via gh auth login. Fails if no PR exists for the specified branch. JSON fields must match available data like title, body, state.
EXAMPLES
gh pr view # View PR for current branch
gh pr view 123 # View PR #123
gh pr view --comments # Include comments
gh pr view --json url,title # JSON output
EXIT CODES
0: success
1: error, e.g., invalid PR, network issue
HISTORY
Introduced in GitHub CLI v0.5.0 (January 2020) as part of core PR subcommands. Evolved with JSON/template support in v1.0+ for better scripting. Actively maintained by GitHub.
SEE ALSO
gh pr list(1), gh pr status(1), gh pr diff(1), git log(1)


