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.
gh pr view 123Syntax
gh pr view [<number> | <url> | <branch>] [flags]Examples
View the PR for the current branch
gh pr viewView a specific PR by number
gh pr view 123Include comments and reviews
gh pr view 123 --commentsOpen the PR on github.com
gh pr view 123 --webPull specific fields as JSON
gh pr view 123 --json state,mergeable,reviewDecisionOptions & flags
| Flag | What it does |
|---|---|
| -c, --comments | Show the pull request's comments and reviews. |
| -w, --web | Open the pull request in the browser. |
| --json | Output specified fields as JSON. |
| -q, --jq | Filter JSON output with a jq expression. |
| -t, --template | Format JSON output with a Go template. |
How to use gh pr view, step by step
- Run
gh pr viewon a PR branch, orgh pr view 123for any PR. - Read the summary, status, and check results inline.
- Add
--commentsto see the full thread. - Script against it with
--jsonand--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.