>_ ghcli.com
ghcli / Pull Requests / gh pr view

gh pr view

Read a PR without leaving your shell

gh pr view prints a pull request's title, description, status, and metadata right in the terminal. Add --comments to include the discussion, or --web to jump to the PR page on github.com.

Quick answer
gh pr view 123

Syntax

gh pr view [<number> | <url> | <branch>] [flags]

Examples

View the PR for the current branch

gh pr view

View a specific PR by number

gh pr view 123

Include comments and reviews

gh pr view 123 --comments

Open the PR on github.com

gh pr view 123 --web

Pull specific fields as JSON

gh pr view 123 --json state,mergeable,reviewDecision

Options & flags

FlagWhat it does
-c, --commentsShow the pull request's comments and reviews.
-w, --webOpen the pull request in the browser.
--jsonOutput specified fields as JSON.
-q, --jqFilter JSON output with a jq expression.
-t, --templateFormat JSON output with a Go template.

How to use gh pr view, step by step

  1. Run gh pr view on a PR branch, or gh pr view 123 for any PR.
  2. Read the summary, status, and check results inline.
  3. Add --comments to see the full thread.
  4. Script against it with --json and --jq.

Common errors and fixes

no pull requests found for branch 'my-branch'

The current branch has no associated PR. Pass a number, or create one with gh pr create.

GraphQL: Could not resolve to a PullRequest with the number of 999

That PR number doesn't exist in this repo. List valid ones with gh pr list.

Related commands

Frequently asked questions

How do I view a pull request in the terminal?

Run gh pr view <number> to print the PR's title, body, and status. From within a PR branch you can drop the number and just run gh pr view.

How do I read PR comments from the command line?

Add the --comments flag: gh pr view 123 --comments shows the description followed by every review and comment in the thread.

Can gh pr view output JSON?

Yes. Use --json with the fields you need, such as state, mergeable, or reviewDecision, and refine with --jq for scripting.