gh-pr-diff - Man Page

View changes in a pull request

Synopsis

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

Description

View changes in a pull request.

Without an argument, the pull request that belongs to the current branch is selected.

With --web flag, open the pull request diff in a web browser instead.

Use --exclude to filter out files matching a glob pattern. The pattern uses forward slashes as path separators on all platforms. You can repeat the flag to exclude multiple patterns.

Options

--color <string> (default "auto")

Use color in diff output: {always|never|auto}

-e, --exclude <patterns>

Exclude files matching glob patterns from the diff

--name-only

Display only names of changed files

--patch

Display diff in patch format

-w,  --web

Open the pull request diff in the browser

Options Inherited from Parent Commands

-R, --repo <[HOST/]OWNER/REPO>

Select another repository using the [HOST/]OWNER/REPO format

Exit Codes

0: Successful execution

1: Error

2: Command canceled

4: Authentication required

NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.

Example

# See diff for current branch
$ gh pr diff

# See diff for a specific PR
$ gh pr diff 123

# Exclude files from diff output
$ gh pr diff --exclude '*.yml' --exclude 'generated/*'

# Exclude matching files by name
$ gh pr diff --name-only --exclude '*.generated.*'

See Also

gh-pr(1)

Referenced By

gh-pr(1).

Mar 2026 GitHub CLI manual