2020-06-23 00:09:42 +05:30
---
stage: Plan
group: Project Management
2021-02-22 17:27:13 +05:30
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-06-23 00:09:42 +05:30
---
2016-09-13 17:45:13 +05:30
# Description templates
2019-07-31 22:56:46 +05:30
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-03-11 19:13:27 +05:30
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-09-13 17:45:13 +05:30
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
in your project's repository under a directory named `.gitlab` . Only the
2021-02-22 17:27:13 +05:30
templates of the default branch are taken into account.
2016-09-13 17:45:13 +05:30
2021-03-11 19:13:27 +05:30
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-07-31 22:56:46 +05:30
- Add a template to be used in every issue for a specific project,
2019-09-30 21:07:59 +05:30
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
2020-04-22 19:07:51 +05:30
title, outlines, author name, author social media information, and so on.
2019-07-31 22:56:46 +05:30
- Following the previous example, you can make a template for every MR submitted
2020-06-23 00:09:42 +05:30
with a new blog post, requiring information about the post date, front matter data,
2020-04-22 19:07:51 +05:30
images guidelines, link to the related issue, reviewer name, and so on.
2019-07-31 22:56:46 +05:30
- You can also create issues and merge request templates for different
2020-04-22 19:07:51 +05:30
stages of your workflow, for example, feature proposal, feature improvement, or a bug report.
2021-03-11 19:13:27 +05:30
- You can use an [issue description template ](#creating-issue-templates ) as a
[Service Desk email template ](service_desk.md#new-service-desk-issues ).
2019-07-31 22:56:46 +05:30
2016-09-13 17:45:13 +05:30
## Creating issue templates
Create a new Markdown (`.md`) file inside the `.gitlab/issue_templates/`
directory in your repository. Commit and push to your default branch.
2020-05-24 23:13:21 +05:30
To create a Markdown file:
2021-03-11 19:13:27 +05:30
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-24 23:13:21 +05:30
2021-02-22 17:27:13 +05:30
If you don't have a `.gitlab/issue_templates` directory in your repository, you need to create it.
2020-05-24 23:13:21 +05:30
To create the `.gitlab/issue_templates` directory:
2021-03-11 19:13:27 +05:30
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-24 23:13:21 +05:30
2021-01-29 00:20:46 +05:30
To check if this has worked correctly, [create a new issue ](issues/managing_issues.md#create-a-new-issue )
2020-05-24 23:13:21 +05:30
and see if you can choose a description template.
2016-09-13 17:45:13 +05:30
## Creating merge request templates
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.
## Using the templates
Let's take for example that you've created the file `.gitlab/issue_templates/Bug.md` .
2021-02-22 17:27:13 +05:30
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-09-13 17:45:13 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-03-11 19:13:27 +05:30
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` .
2021-01-03 14:25:43 +05:30
2016-09-13 17:45:13 +05:30
![Description templates ](img/description_templates.png )
2021-03-11 19:13:27 +05:30
## Setting a default template for merge requests and issues **(PREMIUM)**
2019-07-31 22:56:46 +05:30
2021-03-11 19:13:27 +05:30
> - Moved to GitLab Premium in 13.9.
2019-07-31 22:56:46 +05:30
2021-03-11 19:13:27 +05:30
The visibility of issues or merge requests should be set to either "Everyone
2019-10-12 21:52:04 +05:30
with access" or "Only Project Members" in your project's **Settings / Visibility, project features, permissions** section, otherwise the
2021-02-22 17:27:13 +05:30
template text areas don't show. This is the default behavior, so in most cases
2019-07-31 22:56:46 +05:30
you should be fine.
2020-04-22 19:07:51 +05:30
1. Go to your project's **Settings** .
1. Click **Expand** under the **Merge requests** header.
1. Fill in the **Default description template for merge requests** text area.
1. Click **Expand** under **Default issue template** .
1. Fill in the **Default description template for issues** text area.
Since GitLab merge request and issues support [Markdown ](../markdown.md ), you can use it to format
headings, lists, and so on.
2019-07-31 22:56:46 +05:30
2019-10-12 21:52:04 +05:30
![Default merge request description templates ](img/description_templates_merge_request_settings.png )
2020-04-22 19:07:51 +05:30
2019-10-12 21:52:04 +05:30
![Default issue description templates ](img/description_templates_issue_settings.png )
2019-07-31 22:56:46 +05:30
After you add the description, hit **Save changes** for the settings to take
2021-03-08 18:12:59 +05:30
effect. Now, every time a new merge request or issue is created, it is
2019-07-31 22:56:46 +05:30
pre-filled with the text you entered in the template(s).
2018-03-17 18:26:18 +05:30
## Description template example
2021-03-11 19:13:27 +05:30
We make use of description templates for issues and merge requests in the GitLab project.
For some examples, refer to the [`.gitlab` folder ](https://gitlab.com/gitlab-org/gitlab/tree/master/.gitlab ).
2018-03-17 18:26:18 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-03-11 19:13:27 +05:30
It's possible to use [quick actions ](quick_actions.md ) in description templates to quickly add
2021-02-22 17:27:13 +05:30
labels, assignees, and milestones. The quick actions are only executed if the user submitting
2020-04-22 19:07:51 +05:30
the issue or merge request has the permissions to perform the relevant actions.
2018-03-17 18:26:18 +05:30
2020-04-22 19:07:51 +05:30
Here is an example of a Bug report template:
2018-03-17 18:26:18 +05:30
2021-03-11 19:13:27 +05:30
```markdown
## Summary
2018-03-17 18:26:18 +05:30
(Summarize the bug encountered concisely)
2021-03-11 19:13:27 +05:30
## Steps to reproduce
2018-03-17 18:26:18 +05:30
(How one can reproduce the issue - this is very important)
2021-03-11 19:13:27 +05:30
## Example Project
2018-03-17 18:26:18 +05:30
2021-03-11 19:13:27 +05:30
(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)
2018-03-17 18:26:18 +05:30
2021-03-11 19:13:27 +05:30
## What is the current bug behavior?
2018-03-17 18:26:18 +05:30
(What actually happens)
2021-03-11 19:13:27 +05:30
## What is the expected correct behavior?
2018-03-17 18:26:18 +05:30
(What you should see instead)
2021-03-11 19:13:27 +05:30
## Relevant logs and/or screenshots
2018-03-17 18:26:18 +05:30
2021-03-11 19:13:27 +05:30
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as
it's very hard to read otherwise.)
2018-03-17 18:26:18 +05:30
2021-03-11 19:13:27 +05:30
## Possible fixes
2018-03-17 18:26:18 +05:30
(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
```