OS Manuals

gh-pr-diff(1)

gh-pr-diff - View changes in a pull request

GH-PR-DIFF(1) GitHub CLI manual GH-PR-DIFF(1)

gh-pr-diff - View changes in a pull request

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

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.

By default, terminal escape sequences in the diff are neutralized, since they could manipulate your terminal. Pass --allow-escape-sequences to print the diff verbatim, for example when piping a patch to another program.

Allow printing terminal escape sequences

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

Exclude files matching glob patterns from the diff

Display only names of changed files

Display diff in patch format

Open the pull request diff in the browser

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

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.

# 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.*'

gh-pr(1)

Oct 2026

gh 2.103.2-r0 · os · ingested 2026-10-25