The site that you are currently viewing is a static version of the Software Factory
documentation delivered with the
version v7.2.
For up-to-date documentation, see the
latest version.
GitLab templates
How to use GitLab templates
3 minute read
Create a Description Template
- Navigate to the root directory of your GitLab repository
- Create a
.gitlabdirectory if it doesn’t exist. - Inside the
.gitlabdirectory, create the appropriate subdirectory:- For issue templates: create
issue_templates - For merge request templates: create
merge_request_templates
- For issue templates: create
- Inside the newly created subdirectory, create your Markdown (
.md) files:- For issue templates, examples include
bug_report.md,feature_request.md - For merge request templates, examples include
Feature Merge Request.md,Bug Fix Merge Request.md
- For issue templates, examples include
You should have a similar file structure:
Issue Templates:
.gitlab/
└── issue_templates/
├── bug_report.md
└── feature_request.md
Merge Request Templates:
.gitlab/
└── merge_request_templates/
├── Feature Merge Request.md
└── Bug Fix Merge Request.md
Content example for bug report Template
Edit the markdown file you created (bug_report.md or any other descriptive name) and define the
template content:
# Bug Report
## Summary
<!-- Provide a concise summary of the issue -->
## Steps to Reproduce
<!-- Describe the steps to reproduce the issue -->
1.
2.
3.
## What is the current *bug* behavior?
<!-- Describe what happens currently -->
## What is the expected *correct* behavior?
<!-- Describe what you would expect to happen -->
## Relevant logs and/or screenshots
<!-- Provide any relevant logs or screenshots to help diagnose the issue -->
## Environment
<!-- Provide details about your environment -->
Content examples for Merge Request Template
## Feature Merge Request
**Description:**
(Provide a detailed description of the feature.)
**Related Issues:**
(Link any related issues this merge request addresses.)
**Implementation Details:**
(Describe how you implemented the feature.)
**Screenshots:**
(Include any relevant screenshots.)
**Testing Instructions:**
(Steps for testers to validate the feature.)
**Additional Notes:**
(Any additional information that might be helpful for reviewers.)
Content example with a Definition of Done (DoD) Template
# Issue Title
<!-- Brief description of the issue -->
## Description
<!-- Detailed description of the task -->
## Acceptance Criteria
- [ ] Description of the expected outcome
- [ ] Specific criteria to meet the objective
- [ ] Any relevant details or requirements
## Definition of Done
Ensure the following criteria are met before closing the issue:
- [ ] Code is complete and well-documented
- [ ] Unit tests are written and passing
- [ ] Code has been reviewed and approved by at least one peer
- [ ] Acceptance criteria are fully met
- [ ] No critical bugs or issues remain
- [ ] Documentation (if affected) is updated
Use templates
On bug issue creation
- Go to your project in GitLab.
- Select Plan > Issues.
- Select the “New Issue” button.
- You will see a Use a template dropdown above the issue description field.
- Select your desired template (e.g.,
Bug Report). - The selected template content will be loaded into the issue description field, and you can fill in the specific details related to your issue.
On merge request
- Go to your project in GitLab.
- Select Code > Merge requests.
- Select the “New merge request” button.
- In the merge request creation form, you will see a “Choose a template” dropdown menu on the right side under the description field.
- Select your desired template from the dropdown list.
- The merge request description will automatically populate with the content from the selected template.
Conclusion
Using templates can greatly improve the efficiency and consistency of reviewing and merging code changes in GitLab. If you need more information, refer to the official GitLab documentation on merge request templates .