2020-05-27 03:08:26 +00:00
---
stage: Plan
group: Project Management
2020-11-26 06:09:20 +00:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-05-27 03:08:26 +00:00
---
2016-08-17 10:27:14 +00:00
# Description templates
2019-05-05 15:37:18 +00:00
We all know that a properly submitted issue is more likely to be addressed in
a timely manner by the developers of a project.
2021-01-26 18:09:30 +00:00
With description templates, you can define context-specific templates for issue and merge request
description fields for your project, and filter out unnecessary noise from issues.
2016-08-17 10:27:14 +00:00
By using the description templates, users that create a new issue or merge
request can select a description template to help them communicate with other
contributors effectively.
Every GitLab project can define its own set of description templates as they
are added to the root directory of a GitLab project's repository.
Description templates must be written in [Markdown ](../markdown.md ) and stored
2021-03-12 09:09:06 +00:00
in your project's repository in the `.gitlab` directory. Only the
2020-12-07 18:10:36 +00:00
templates of the default branch are taken into account.
2016-08-17 10:27:14 +00:00
2021-01-26 18:09:30 +00:00
To learn how to create templates for various file types in groups, visit
[Group file templates ](../group/index.md#group-file-templates ).
## Use cases
2019-05-05 15:37:18 +00:00
2021-03-12 09:09:06 +00:00
These are some situations when you might find description templates useful:
- You can create issues and merge request templates for different
stages of your workflow, for example, feature proposal, feature improvement, or a bug report.
2019-05-05 15:37:18 +00:00
- Add a template to be used in every issue for a specific project,
2019-06-25 04:34:55 +00:00
giving instructions and guidelines, requiring for information specific to that subject.
For example, if you have a project for tracking new blog posts, you can require the
2021-03-12 09:09:06 +00:00
title, outlines, author name, and author social media information.
2019-05-05 15:37:18 +00:00
- Following the previous example, you can make a template for every MR submitted
2020-05-20 06:08:06 +00:00
with a new blog post, requiring information about the post date, front matter data,
2020-04-01 03:07:57 +00:00
images guidelines, link to the related issue, reviewer name, and so on.
2019-05-05 15:37:18 +00:00
- You can also create issues and merge request templates for different
2020-04-01 03:07:57 +00:00
stages of your workflow, for example, feature proposal, feature improvement, or a bug report.
2021-02-18 12:09:34 +00:00
- You can use an [issue description template ](#create-an-issue-template ) as a
2021-01-29 00:09:17 +00:00
[Service Desk email template ](service_desk.md#new-service-desk-issues ).
2019-05-05 15:37:18 +00:00
2021-02-18 12:09:34 +00:00
## Create an issue template
2016-08-17 10:27:14 +00:00
Create a new Markdown (`.md`) file inside the `.gitlab/issue_templates/`
directory in your repository. Commit and push to your default branch.
2020-05-19 18:08:11 +00:00
To create a Markdown file:
2021-01-21 15:08:36 +00:00
1. Click the `+` button next to `master` and click **New file** .
1. Add the name of your issue template to the **File name** text field next to `master` .
Make sure that your file has the `.md` extension, for
example `feature_request.md` or `Feature Request.md` .
1. Commit and push to your default branch.
2020-05-19 18:08:11 +00:00
2020-12-07 18:10:36 +00:00
If you don't have a `.gitlab/issue_templates` directory in your repository, you need to create it.
2020-05-19 18:08:11 +00:00
To create the `.gitlab/issue_templates` directory:
2021-01-21 15:08:36 +00:00
1. Click the `+` button next to `master` and select **New directory** .
1. Name this new directory `.gitlab` and commit to your default branch.
1. Click the `+` button next to `master` again and select **New directory** .
1. Name your directory `issue_templates` and commit to your default branch.
2020-05-19 18:08:11 +00:00
2020-11-09 03:09:03 +00:00
To check if this has worked correctly, [create a new issue ](issues/managing_issues.md#create-a-new-issue )
2020-05-19 18:08:11 +00:00
and see if you can choose a description template.
2021-02-18 12:09:34 +00:00
## Create a merge request template
2016-08-17 10:27:14 +00:00
Similarly to issue templates, create a new Markdown (`.md`) file inside the
`.gitlab/merge_request_templates/` directory in your repository. Commit and
push to your default branch.
2021-02-18 12:09:34 +00:00
## Use the templates
2016-08-17 10:27:14 +00:00
2016-08-17 12:27:18 +00:00
Let's take for example that you've created the file `.gitlab/issue_templates/Bug.md` .
2020-12-07 18:10:36 +00:00
This enables the `Bug` dropdown option when creating or editing issues. When
`Bug` is selected, the content from the `Bug.md` template file is copied
to the issue description field. The **Reset template** button discards any
changes you made after picking the template and returns it to its initial status.
2016-08-17 10:27:14 +00:00
2020-12-08 03:09:37 +00:00
NOTE:
2021-01-26 18:09:30 +00:00
You can create shortcut links to create an issue using a designated template.
For example: `https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Feature%20proposal` .
2020-09-30 18:09:52 +00:00
2016-08-17 10:27:14 +00:00
![Description templates ](img/description_templates.png )
2021-03-24 09:09:10 +00:00
You can set description templates at various levels:
2019-05-05 15:37:18 +00:00
2021-03-24 09:09:10 +00:00
- The entire [instance ](#set-instance-level-description-templates )
- A specific [group or subgroup ](#set-group-level-description-templates )
- A specific [project ](#set-a-default-template-for-merge-requests-and-issues )
2021-02-18 12:09:34 +00:00
2021-03-24 09:09:10 +00:00
The templates are inherited. For example, in a project, you can also access templates set for the
instance or the project's parent groups.
2021-02-18 12:09:34 +00:00
2021-03-24 09:09:10 +00:00
### Set instance-level description templates **(PREMIUM SELF)**
2021-02-18 12:09:34 +00:00
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52360) in GitLab 13.9.
> - It's [deployed behind a feature flag](../feature_flags.md), disabled by default.
2021-03-24 09:09:10 +00:00
> - [Became enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56737) in GitLab 13.11.
> - It's enabled by default on GitLab.com.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-issue-and-merge-request-description-templates-at-group-and-instance-level). **(PREMIUM SELF)**
You can set a description template at the **instance level** for issues
and merge requests.
As a result, these templates are available in all projects within the instance.
2021-02-18 12:09:34 +00:00
Only instance administrators can set instance-level templates.
To set the instance-level description template repository:
1. Select the **Admin Area** icon (**{admin}**).
1. Go to **Settings > Templates** .
1. From the dropdown, select your template project as the template repository at instance level.
2021-03-24 09:09:10 +00:00
1. Select **Save changes** .
![Setting templates in the Admin Area ](../admin_area/settings/img/file_template_admin_area.png )
2021-02-18 12:09:34 +00:00
Learn more about [instance template repository ](../admin_area/settings/instance_template_repository.md ).
2021-03-24 09:09:10 +00:00
### Set group-level description templates **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52360) in GitLab 13.9.
> - It's [deployed behind a feature flag](../feature_flags.md), disabled by default.
> - [Became enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56737) in GitLab 13.11.
> - It's enabled by default on GitLab.com.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-issue-and-merge-request-description-templates-at-group-and-instance-level). **(PREMIUM SELF)**
With **group-level** description templates, you can store your templates in a single repository and
configure the group file templates setting to point to that repository.
As a result, you can use the same templates in issues and merge requests in all the group's projects.
To re-use templates [you've created ](../project/description_templates.md#create-an-issue-template ):
1. Go to the group's **Settings > General > Templates** .
1. From the dropdown, select your template project as the template repository at group level.
1. Select **Save changes** .
![Group template settings ](../group/img/group_file_template_settings.png )
2021-02-18 12:09:34 +00:00
### Set a default template for merge requests and issues **(PREMIUM)**
2019-05-05 15:37:18 +00:00
2021-03-24 09:09:10 +00:00
In a project, you can choose a default description template for new issues and merge requests.
As a result, every time a new merge request or issue is created, it's pre-filled with the text you
entered in the template.
2021-01-26 18:09:30 +00:00
The visibility of issues or merge requests should be set to either "Everyone
2021-03-24 09:09:10 +00:00
with access" or "Only Project Members" in your project's
**Settings / Visibility, project features, permissions** section. Otherwise, the
2020-12-07 18:10:36 +00:00
template text areas don't show. This is the default behavior, so in most cases
2019-05-05 15:37:18 +00:00
you should be fine.
2021-03-12 09:09:06 +00:00
To set a default description template for merge requests:
2020-04-01 03:07:57 +00:00
1. Go to your project's **Settings** .
2021-03-12 09:09:06 +00:00
1. Select **Expand** under the **Merge requests** header.
2020-04-01 03:07:57 +00:00
1. Fill in the **Default description template for merge requests** text area.
2021-03-12 09:09:06 +00:00
1. Select **Save changes** .
To set a default description template for issues:
2019-05-05 15:37:18 +00:00
2021-03-12 09:09:06 +00:00
1. Select **Expand** under **Default issue template** .
1. Fill in the **Default description template for issues** text area.
2020-04-01 03:07:57 +00:00
2021-03-12 09:09:06 +00:00
Because GitLab merge request and issues support [Markdown ](../markdown.md ), you can use it to format
headings, lists, and so on.
2019-05-05 15:37:18 +00:00
2021-03-10 18:09:32 +00:00
[GitLab versions 13.10 and later ](https://gitlab.com/gitlab-org/gitlab/-/issues/885 )
provide `issues_template` and `merge_requests_template` attributes in the
[Projects API ](../../api/projects.md ) to help you keep your templates up to date.
2017-09-06 08:32:31 +00:00
## Description template example
2021-03-12 09:09:06 +00:00
We use description templates for issues and merge requests in the
[`.gitlab` folder ](https://gitlab.com/gitlab-org/gitlab/tree/master/.gitlab ) of the
GitLab project, which you can refer to for some examples.
2017-09-06 08:32:31 +00:00
2020-12-08 03:09:37 +00:00
NOTE:
2021-01-26 18:09:30 +00:00
It's possible to use [quick actions ](quick_actions.md ) in description templates to quickly add
2020-12-07 18:10:36 +00:00
labels, assignees, and milestones. The quick actions are only executed if the user submitting
2020-04-01 03:07:57 +00:00
the issue or merge request has the permissions to perform the relevant actions.
2017-09-06 08:32:31 +00:00
2021-03-12 09:09:06 +00:00
Here is an example of a bug report template:
2017-09-06 08:35:00 +00:00
2021-01-26 18:09:30 +00:00
```markdown
## Summary
2017-09-06 08:35:00 +00:00
(Summarize the bug encountered concisely)
2021-01-26 18:09:30 +00:00
## Steps to reproduce
2017-09-06 08:35:00 +00:00
(How one can reproduce the issue - this is very important)
2021-01-26 18:09:30 +00:00
## Example Project
2017-09-06 08:35:00 +00:00
2021-01-26 18:09:30 +00:00
(If possible, please create an example project here on GitLab.com that exhibits the problematic
behavior, and link to it here in the bug report.
If you are using an older version of GitLab, this will also determine whether the bug has been fixed
in a more recent version)
2021-01-14 03:10:47 +00:00
2021-01-26 18:09:30 +00:00
## What is the current bug behavior?
2017-09-06 08:35:00 +00:00
(What actually happens)
2021-01-26 18:09:30 +00:00
## What is the expected correct behavior?
2017-09-06 08:35:00 +00:00
(What you should see instead)
2021-01-26 18:09:30 +00:00
## Relevant logs and/or screenshots
2017-09-06 08:35:00 +00:00
2021-01-26 18:09:30 +00:00
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as
it's very hard to read otherwise.)
2017-09-06 08:35:00 +00:00
2021-01-26 18:09:30 +00:00
## Possible fixes
2017-09-06 08:35:00 +00:00
(If you can, link to the line of code that might be responsible for the problem)
/label ~bug ~reproduced ~needs-investigation
/cc @project -manager
/assign @qa -tester
```
2021-02-18 12:09:34 +00:00
## Enable or disable issue and merge request description templates at group and instance level
Setting issue and merge request description templates at group and instance levels
is under development and not ready for production use. It is deployed behind a
2021-03-24 09:09:10 +00:00
feature flag that is **enabled by default** .
2021-02-18 12:09:34 +00:00
[GitLab administrators with access to the GitLab Rails console ](../../administration/feature_flags.md )
2021-03-24 09:09:10 +00:00
can disable it.
2021-02-18 12:09:34 +00:00
To enable it:
```ruby
Feature.enable(:inherited_issuable_templates)
```
To disable it:
```ruby
Feature.disable(:inherited_issuable_templates)
```
The feature flag affects these features:
- Setting a templates project as issue and merge request description templates source at group level.
- Setting a templates project as issue and merge request description templates source at instance level.