GH-PR-DIFF(1)

πŸ’… gh-pr-diff(1) β€” the GitHub CLI manual, bestie edition 🫢

okay so picture this: it's giving "show me what actually changed in this pull request" and honestly? iconic. this is gh-pr-diff, straight out of the GitHub CLI manual, and yes she absolutely ate.


✨ NAME ✨

gh-pr-diff β€” view the changes in a pull request, no cap πŸ‘‘


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

View changes in a pull request. that's the whole vibe, that's the assignment πŸ’–

If you don't give it an argument, it picks the pull request that belongs to the current branch. so like, it already knows. main character energy fr fr ✨

With the --web flag, it opens the pull request diff in a web browser instead. browser girlies rise 🌈

Use --exclude to filter out files matching a glob pattern. quick note though, bestie: the pattern uses forward slashes as path separators on all platforms. all of them. no exceptions. and you can repeat the flag to exclude multiple patterns, so go off πŸ’…

okay and this part is important, listen up 🫢 β€” by default, terminal escape sequences in the diff are neutralized, because they could manipulate your terminal. like, literally could take over your terminal. not cute. so if you want the diff printed verbatim, pass --allow-escape-sequences, for example when you're piping a patch to another program. that's the only time, i'm watching you πŸ™ˆ


πŸŽ€ OPTIONS πŸŽ€

  • --allow-escape-sequences β€” allow printing terminal escape sequences. yes, the raw ones. you asked for it πŸ’€
  • --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. no contents, just the roster ✨
  • --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. inherited from the parent command, so it's like a hand-me-down but make it fashion πŸ’œ

πŸ’€ EXIT CODES πŸ’€

  • 0: successful execution β€” slay πŸŽ‰
  • 1: error β€” 😭
  • 2: command canceled β€” nvm bestie
  • 4: authentication required β€” log in, babe πŸ”‘
NOTE: specific commands may have additional exit codes. refer to the command's help for more information. iykyk 🧚

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

like, look at her go. obsessed πŸ’–


πŸ“ SEE ALSO πŸ“

  • gh-pr(1) β€” the parent, the blueprint, the icon

and that's the page !! this one's from GitHub CLI v2.102.0, dated Oct 2026 β€” mwah, take care of her, and go look at some diffs πŸ’…βœ¨

πŸ“¦ where this page comes from