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:

ValueDefinitionDefault valueMaximum value
Maximum diff patch sizeThe total size, in bytes, of the entire diff.200 KB500 KB
Maximum diff filesThe total number of files changed in a diff.10003000
Maximum diff linesThe total number of lines changed in a diff.50,000100,000
Maximum diff versionsThe number of diff versions per merge request.1,000None
Maximum diff commitsThe total number of diff commits across all versions per merge request.1,000,000None

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:

  1. In the upper-right corner, select Admin.
  2. In the left sidebar, select Settings > General.
  3. Expand Diff limits.
  4. Enter a value for the diff limit.
  5. Select Save changes.