In May we shipped a setting for including the pull request title in the default commit message presented to users when squash merging a pull request. We just shipped more options for customizing the default commit message, including using the pull request's description! You can also now customize the default commit messages for merge commit merges. The goal is more predictable, consistent, and useful commit messages for your pull requests, which translate to a more useful Git commit history.
How it works
From repository settings, a maintainer or admin can choose the default format for commit messages produced when merging pull requests:
This selection is used to form a default commit message that gets presented to users on the pull request page when merging a pull request. For example, assume Default to pull request title and description is selected and a user clicks to merge a pull request with this description:
The default commit message will include the pull request's title and description:
The user can then accept this commit message or make changes before merging.
Options
For merge commit merging:
- Default message: pull request number and head branch on the first line; pull request title on the third line
- Pull request title: pull request title and number on the first line
- Pull request title and description: pull request title and number on the first line; pull request description starting on the third line
For squash merging:
- Default message: commit title and commit message (if the pull request contains a single commit), or the pull request title and number and list of commits (if the pull request contains multiple commits)
- Pull request title: pull request title and number on the first line
- Pull request title and commit details: pull request title and number on the first line; commit message (if a single commit) or list of commits (if multiple commits)
- Pull request title and description: pull request title and number on the first line; pull request description starting on the third line
Additional details
If no message is provided when merging a pull request using the REST API or GraphQL mutation, a default commit message will be formed based on the selected message format and merge method.
The default message format can be managed using the Create a repository or Update a repository REST APIs. See the merge_commit_title
, merge_commit_message
, and squash_merge_commit_title
, squash_merge_commit_message
parameters.
Feedback
We want to hear from you! Tell us what you think and how we can make it better: https://github.com/orgs/community/discussions/30439
Learn more
Learn more about configuring merge commit merging and configuring squash merging.