The Excluded files filter is only available in the new pull request experience, and only repository administrators can add files to be excluded from the diff view.

The pull request view shows each file modified in the pull request. 
You can exclude files from appearing in the diff view of a pull request by specifying patterns in the 'Excluded files' repository setting page.

To exclude certain files from appearing in pull requests:

  1. In the repository containing the pull request, click Settings > Excluded files in the Pull Requests section.
  2. In the Patterns field, enter patterns to exclude from pull request diff views.
  3. Click Save.

Each line you add to the Patterns field specifies a pattern to exclude. 

A pattern can be:

  • a filename (e.g. index.min.js).
  • a path relative to the repository root (e.g. /minified/index.min.js).
  • a pattern including wildcards (e.g. *.min.js or /minified/** ).

Files that match any pattern entered will still appear in the file tree and in the list of files changed for a pull request, but the changed content of those excluded files won't appear in the diff view.

Excluded files pattern format

The excluded files repository setting format is similar to the .gitignore pattern format with two notable exceptions:

  • Trailing spaces are not allowed.
  • There is no way to negate a pattern.

Important details

  • Matching is case-insensitive.
  • Directories are indicated by a forward slash "/".
  • Backslash "\" is used to escape special characters.
  • Non-ASCII characters are supported. UTF-8 encoding is assumed.

# package manager lock files (at the repository root)

# minified JS and CSS (anywhere in the repository)

# third-party libraries

# generated XML (inside any my-code-generator/ directory)

# text files from November 2017

Blank lines and comments

File patterns can be organized with blank lines and comments. Each non-blank line can contain either a pattern or a comment, not both.


[blank line]

NothingBlank lines can be used as separators.

# comment

NothingAny line beginning with # is ignored.


A file or files can be excluded by filename. If a filename contains special characters, those characters must be escaped with backslashes.

  • To exclude a single, specific file, start your pattern with "/" which returns matches relative to the root of the repository.
  • To exclude every file that matches a filename, do not add the leading "/".
  • package-lock.json
A single file named package-lock.json at the root of the repository.
  • package-lock.json
  • some/path/package-lock.json
Any file named package-lock.json anywhere in the repository.
  • lib/foo.lib
A single file named foo.lib in a directory named lib at the root of the repository.
  • lib/foo.lib
  • some/other/lib/FOO.LIB
Any file named foo.lib in a directory named lib anywhere in the repository.
file\[version\ 2\].js
  • file[version 2].js
  • some/file[version 2].js

Any file named file[version 2].js. Note the backslashes in the pattern.

Directory name

A pattern ending with "/" matches files contained in that directory.

  • minified/file_a.min.css
  • minified/file_b.min.js
Any file in a directory named minified at the root of the repository.
  • minified/file_a.min.css
  • some/path/MINIFIED/file_b.min.js

Any file in a directory named minified anywhere in the repository.

  • minified/js/file_a.min.js
  • some/path/minified/js/file_b.min.js
Any file in a directory named js in a directory named minified anywhere in the repository.


[] wildcard

The [] wildcard matches one character in a selected range or character class.



  • file_x.c
  • some/path/file_y.c
  • some/other/path/file_z.c
[] can include a list of specific characters.
  • file_a.c
  • some/path/FILE_R.c
  • some/other/path/file_z.c
[] can be used with - to specify a range of characters.
  • file_00.c
  • some/path/file_15.c
  • some/other/path/file_99.c
[0-9] matches a single digit.
  • file_].c
  • some/path/file_-.c

[] is one way to match special characters.

Note: A right bracket "]" normally marks the end of a character class. It is included in the character class if it appears first in the list.
  • some/path/file_.c
Non-ASCII characters are supported.

? wildcard

The ? wildcard matches any single character except "/".



  • file_x.c
  • some/path/file_y.c
  • snowman/file_☃.c
  • mountain/file_.c
Non-ASCII characters are supported.

* wildcard

The * wildcard matches anything except "/".



  • core.min.js
  • some/path/index.min.js

  • file_.c
  • file_x.c
  • some/path/file_門員.c
  • some/file_stuff [version 2].c

* can match an empty string.
  • dir/file.c
  • some/path/directoryX/file.c

** wildcard

The ** wildcard matches anything in the path name including nested directories. Using more than two consecutive ** results in an invalid pattern that matches nothing.



  • core.min.js
  • some/path/index.min.js
Same as *.min.js.
  • my/path/leftpad.js
  • other/MY/PATH/patent/middleout.rb
A trailing /** matches everything in the last named directory.
  • my/path/core.min.js
  • other/my/path/some/index.min.js

  • lib/py/
  • lib/work_in_progress/py/
/**/ matches zero or more directories.