Issue closing pattern

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab Self-Managed

This page explains how an administrator can configure issue closing patterns. For user documentation about the feature, see Closing issues automatically.

When a commit or merge request resolves one or more issues, GitLab can close those issues when the commit or merge request lands in the project’s default branch.

Change the issue closing pattern

The default issue closing pattern covers a wide range of words.

To change the default issue closing pattern to suit your needs:

  1. Edit /etc/gitlab/gitlab.rb and change the gitlab_rails['gitlab_issue_closing_pattern'] value:

    Copy to clipboard
    gitlab_rails['gitlab_issue_closing_pattern'] = /<regular_expression>/.source
  2. Save the file and reconfigure GitLab:

    Copy to clipboard
    sudo gitlab-ctl reconfigure

To test the issue closing pattern, use Rubular. Rubular does not understand %{issue_ref}. When you test your patterns, replace this string with #\d+, which matches only local issue references like #123.