Skip to content

feat(pr diff): add --exclude flag to filter files from diff output#12655

Draft
yuvrajangadsingh wants to merge 1 commit intocli:trunkfrom
yuvrajangadsingh:feature/pr-diff-exclude
Draft

feat(pr diff): add --exclude flag to filter files from diff output#12655
yuvrajangadsingh wants to merge 1 commit intocli:trunkfrom
yuvrajangadsingh:feature/pr-diff-exclude

Conversation

@yuvrajangadsingh
Copy link

Adds a --exclude (-e) flag to gh pr diff that lets you filter out files matching glob patterns from the diff output.

Example usage:

# Exclude all YAML files
gh pr diff --exclude '*.yml'

# Exclude multiple patterns
gh pr diff --exclude '*.yml' --exclude 'vendor/*'

# Works with --name-only too
gh pr diff --name-only --exclude '*.generated.*'

Patterns are matched against both the full file path and the basename, so --exclude '*.yml' will match dir/file.yml.

Uses Go's filepath.Match for glob support — no new dependencies.

Closes #8739

Add a new --exclude (-e) flag to gh pr diff that allows users to exclude
files matching glob patterns from the diff output. This is useful for
filtering out auto-generated files, vendor directories, or other noise
when reviewing pull requests.

Supports standard glob patterns and can be specified multiple times.
Patterns match against both the full path and basename.

Closes cli#8739
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add File Exclusion Option to gh pr diff Command

1 participant