Skip to main content

Command referencegh pr view

gh pr view command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitbeginner

What it does

Display pull request metadata, body, and checks in the terminal or browser. When people search for gh pr view, they usually want practical GitHub CLI flags, safe examples, and how this subcommand fits everyday PR and repo workflows on Linux, Windows, and macOS. Syntax, options, and copyable examples are below.

Display pull request metadata, body, and checks in the terminal or browser.

Syntax

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

Common options

Flag / optionMeaning
-w, --webOpen the pull request in a browser.
-c, --commentsInclude comments.
--jsonMachine-readable field selection.

Practical examples

Current branch PR

gh pr view

Shows the pull request associated with the checked-out branch.

By number

gh pr view 123

Prints details for PR 123.

Open web

gh pr view 123 -w

Opens the PR page for review in the browser.

Common mistakes

  • Running `gh pr view` on a branch that has no open pull request.
  • Confusing view with `gh pr diff`, which focuses on the patch.

FAQ

What does gh pr view do in GitHub CLI?

Display pull request metadata, body, and checks in the terminal or browser.

Does gh pr view work on Windows and Linux?

Yes. The GitHub CLI (`gh`) runs on Linux, Windows, and macOS with the same subcommand syntax after you authenticate with `gh auth login`.

What is a practical gh pr view example?

Try `gh pr view` — Shows the pull request associated with the checked-out branch.

Do I need a token in the command line for gh pr view?

Prefer `gh auth login` so credentials stay in the system keyring or secure storage. Avoid pasting personal access tokens into shell history.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.