doc/user/project/merge_requests/title_templates.md
{{< details >}}
{{< /details >}}
{{< history >}}
mr_default_title_template. Disabled by default. This feature is in beta.mr_default_title_template removed.{{< /history >}}
Merge request title templates define the default title for new merge requests in a project. Use templates to standardize merge request naming conventions across your team.
Templates support variables that expand to values like the source branch name or the first commit message. Users can edit the title before creating the merge request.
Prerequisites:
To configure a merge request title template:
To remove the template and restore the default behavior, clear the template field and select Save changes.
Title templates support the following variables:
| Variable | Description | Output example |
|---|---|---|
%{source_branch} | The name of the source branch. | my-feature-branch |
%{target_branch} | The name of the target branch. | main |
%{title_from_branch} | The source branch name converted to a human-readable format. Hyphens and underscores are replaced with spaces. | My feature branch |
%{first_commit_title} | The subject (first line) of the first commit in the merge request. | Update README.md |
%{issue_id} | The IID of the issue linked through the source branch name (for example, 123 from 123-fix-bug). Blank if no issue is detected. | 123 |
%{issue_title} | The title of the issue linked through the source branch name. Blank if no issue is detected. | Fix login bug |
| Template | Result |
|---|---|
%{source_branch} | my-feature-branch |
%{title_from_branch} | My feature branch |
%{first_commit_title} | Update README.md |
Draft: %{title_from_branch} | Draft: My feature branch |
[%{source_branch}] %{first_commit_title} | [my-feature-branch] Update README.md |
Resolve %{issue_id} "%{issue_title}" | Resolve 123 "Fix login bug" |
When you create a merge request, GitLab assigns the title in this order:
When no title template is configured and you don't provide a title, GitLab generates the title by checking these conditions in order:
123-fix-typo, the title is Resolve "<your_issue_title>".If the merge request has no commits, or you mark it as a draft, GitLab prepends Draft:
to the title.