Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
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:
In the repository containing the pull request, click Repository settings > Excluded files in the Pull Requests section.
In the Patterns field, enter patterns to exclude from pull request diff views.
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.
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.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# package manager lock files (at the repository root)
/Gemfile.lock
/package-lock.json
# minified JS and CSS (anywhere in the repository)
*.min.js
*.min.css
# third-party libraries
/vendor/**
# generated XML (inside any my-code-generator/ directory)
my-code-generator/*.xml
# text files from November 2017
notes/2017-11-[0-3][0-9].txt
File patterns can be organized with blank lines and comments. Each non-blank line can contain either a pattern or a comment, not both.
Pattern | Matches | Notes |
---|---|---|
[blank line] | Nothing | Blank lines can be used as separators. |
# comment | Nothing | Any 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 "/".
Pattern | Matches | Notes |
---|---|---|
/package-lock.json |
| A single file named package-lock.json at the root of the repository. |
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 |
| Any file named foo.lib in a directory named lib anywhere in the repository. |
file\[version\ 2\].js |
| Any file named file[version 2].js. Note the backslashes in the pattern. |
A pattern ending with "/" matches files contained in that directory.
Pattern | Matches | Notes |
---|---|---|
/minified/ |
| Any file in a directory named minified at the root of the repository. |
minified/ |
| Any file in a directory named minified anywhere in the repository. |
minified/js/ |
| Any file in a directory named js in a directory named minified anywhere in the repository. |
The [] wildcard matches one character in a selected range or character class.
Pattern | Matches | Notes |
---|---|---|
file_[xyz].c |
| [] can include a list of specific characters. |
file_[a-z].c |
| [] can be used with - to specify a range of characters. |
file_[0-9][0-9].c |
| [0-9] matches a single digit. |
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. |
file_[高雄].c |
| Non-ASCII characters are supported. |
The ? wildcard matches any single character except "/".
Pattern | Matches | Notes |
---|---|---|
file_?.c |
| Non-ASCII characters are supported. |
The * wildcard matches anything except "/".
Pattern | Matches | Notes |
---|---|---|
*.min.js |
|
|
file_*.c |
| * can match an empty string. |
dir*/file.c |
|
|
The ** wildcard matches anything in the path name including nested directories. Using more than two consecutive ** results in an invalid pattern that matches nothing.
Pattern | Matches | Notes |
---|---|---|
**/*.min.js |
| Same as *.min.js. |
my/path/** |
| A trailing /** matches everything in the last named directory. |
my/path/**/*.min.js |
|
|
/lib/**/py/ |
| /**/ matches zero or more directories. |
Was this helpful?