Diff limits administration
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed, GitLab Dedicated
Showing the full contents of large files can slow down merge requests. To prevent this, you can configure limits for diffs displayed in merge requests, including the maximum diff size, number of files changed, number of lines changed, diff versions, and diff commits. These limits apply to both the GitLab UI and API endpoints that return diff information.
When a diff reaches 10% of the maximum diff patch size, maximum diff files, or maximum diff lines values, GitLab shows the files in a collapsed view with a link to expand the diff. Diffs that exceed any of these three values are shown as Too large, and you cannot expand them in the UI.
The maximum diff versions and maximum diff commits values limit merge request updates. Merge requests that reach these limits cannot be updated further:
| Value | Definition | Default value | Maximum value |
|---|---|---|---|
| Maximum diff patch size | The total size, in bytes, of the entire diff. | 200 KB | 500 KB |
| Maximum diff files | The total number of files changed in a diff. | 1000 | 3000 |
| Maximum diff lines | The total number of lines changed in a diff. | 50,000 | 100,000 |
| Maximum diff versions | The number of diff versions per merge request. | 1,000 | None |
| Maximum diff commits | The total number of diff commits across all versions per merge request. | 1,000,000 | None |
Diff limits cannot be configured on GitLab.com.
For details about diff files, view changes between files. Read more about the built-in limits for merge requests and diffs.
Configure diff limits
These settings are experimental. An increased maximum increases resource consumption of your instance. Keep this in mind when adjusting the maximum.
Prerequisites:
- Administrator access.
To set maximum values for diff display in merge requests:
- In the upper-right corner, select Admin.
- In the left sidebar, select Settings > General.
- Expand Diff limits.
- Enter a value for the diff limit.
- Select Save changes.