How to set up GitHub/GitLab issue and PR templates

Β·

2 min read

Templates for both GitLab and GitHub

Use the content that works best for you, here there are mine.

TemplateSnippet
issueπŸ™ GitHub snippet
pull request / merge requestπŸ™ GitHub snippet
releaseπŸ™ GitHub snippet

Basic

GitHub

  • Create .github folder in project root.
  • Add templates files following this folder structure
β”œβ”€β”€ .gitlab/
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE/
β”‚   β”‚   β”œβ”€β”€ issue-templates.md
β”‚   β”œβ”€β”€ PULL_REQUEST_TEMPLATE/
β”‚   β”‚   β”œβ”€β”€ merge-request-templates.md
β”‚   β”œβ”€β”€ RELEASE_TEMPLATE/
β”‚   β”‚   β”œβ”€β”€ release-templates.md
  • Commit and push on our default branch.

  • Check our project on GitHub. From now on, when we will open an issue, it will be pre-compiled with the markdown template we added.

issue template 01

issue template 02

GitLab

In GitLab is pretty much the same, but here we have to create a folder named .gitlab, and add this folders structure:

β”œβ”€β”€ .gitlab/
β”‚   β”œβ”€β”€ issue_templates/
β”‚   β”‚   β”œβ”€β”€ issue-templates.md
β”‚   β”œβ”€β”€ merge_request_templates/
β”‚   β”‚   β”œβ”€β”€ merge-request-templates.md
β”‚   β”œβ”€β”€ release_templates/
β”‚   β”‚   β”œβ”€β”€ release-templates.md

Advanced

If we need different templates to choose, we have to add folders instead of files, and add many files as we need.

β”œβ”€β”€ .github
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE
β”‚   β”‚   β”œβ”€β”€ bug-report.md
β”‚   β”‚   β”œβ”€β”€ feature.md
β”‚   β”‚   β”œβ”€β”€ nice-to-have.md
β”‚   β”œβ”€β”€ PULL_REQUEST_TEMPLATE.md
β”‚   β”œβ”€β”€ RELEASE_TEMPLATE
β”‚   β”‚   β”œβ”€β”€ default.md
β”‚   β”‚   β”œβ”€β”€ hotfix.md

πŸ“š More info