DEV Community

Giulia Chiola
Giulia Chiola

Posted on • Edited on • Originally published at giuliachiola.dev

How to set up GitHub/GitLab issue and PR templates

Templates for both GitLab and GitHub

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

Template Snippet
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
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“š More info

Top comments (0)