Bitbucket pull request templates
A pull request template is text that Bitbucket puts in the description of each new pull request: a short checklist, the headings a team wants filled in. Bitbucket Cloud and Bitbucket Data Center both have one, but they keep it in different places: Cloud in a file in the repository (or a repository setting), Data Center in the project or repository settings. Below are the rules from Atlassian's pages, and what to check when the template does not appear.
Bitbucket Cloud: the template file
Commit a Markdown file at exactly this path:
.bitbucket/pull_request_template.md
- Bitbucket reads it from the pull request's source branch. If the source and the destination both have the file, the source branch's copy is used (Atlassian's Pull Request templates in Bitbucket Cloud).
- The file supports Markdown, like the description itself.
- In a description,
{{commit_messages}}becomes a list of the pull request's commit messages when it is created (Atlassian's Create a pull request).
Bitbucket Cloud: the Default description setting
Repository admins can also set the text in Repository settings > Default description, and Bitbucket adds it to every new pull request in that repository (announced in January 2019 in Save time with default pull request descriptions). It is a per-repository setting: there is no workspace-wide default. Atlassian's pages do not say which wins when a repository has both the setting and the file.
With neither, the description of a pull request with more than one commit starts as the list of its commits.
Bitbucket Data Center: the description template
From Bitbucket Data Center 7.13, project and repository admins set it in Project settings > Description template or Repository settings > Description template (Atlassian's Create a pull request):
- A repository inherits the project's template unless Use custom settings is chosen under Project settings inheritance in its own settings.
- The template fills the description field on the Create pull request page.
- Without a template, the description starts as the commit history. Template behavior can keep that: Use the commit history as the default description.
- The template is kept in the server's settings, not in a file in the repository.
When the template does not show up
- Cloud: the source branch does not have the file. It is read from the source branch, so a branch made before the template was committed to
maindoes not have it. Merge or rebasemaininto the branch. - Cloud: the path is different.
.github/pull_request_template.mdis where GitHub looks, and.azuredevops/is Azure Repos; Bitbucket Cloud reads only.bitbucket/pull_request_template.md. - Data Center: the repository does not inherit. A repository with its own settings uses its own template (or none), not the project's.
- Data Center: the server is older than 7.13. There is no description template before 7.13.
- The pull request was not made on the web page. These are the rules of the Create pull request page. A pull request created through the REST API or another tool gets what that tool sends as the description.
Pull request templates in IntelliJ IDEA
Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the Bitbucket Cloud and Bitbucket Data Center pull requests waiting for your review in an IDE tool window and creates pull requests from your current branch. From version 1.0.45, on Bitbucket Cloud the create dialog fills the description from .bitbucket/pull_request_template.md on the source branch, as the web page does, and says which file it used. The Cloud Default description setting and the Data Center description template have no documented REST API, so the plugin cannot read them and the description starts empty there. Creating, approving, commenting and merging are Pro, with a 30-day trial; the review inbox, the diff and the merge checks are free.
Get it on JetBrains Marketplace
Bitbucket is a trademark of Atlassian Pty Ltd; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.
More: default reviewers · draft pull requests · tasks and default tasks · 日本語