Feedback: New options for controlling the default commit message when merging a pull request #30439
Replies: 28 comments 33 replies
-
This is great, no more test / test / fix typo / ... commit messages when squashing! The only drawback I can see for the "default to pull request title and description" message is that a paragraph from the description becomes a single, potentially very long line without editing: This PR description becomes this log message: I know that the PR description field is a bit special in that it's Markdown, but linebreaks are respected, so what looks good in a log message looks weirdly short-lined in the PR description. Is it thinkable to word-wrap the description at 80 characters when converting to log message? Might not be perfect, but better than super long lines, maybe? |
Beta Was this translation helpful? Give feedback.
-
What's the roapmap for making this part of GHE? |
Beta Was this translation helpful? Give feedback.
-
Awesome and long awaited. Can there also be an option for only the description? Thanks for these cool options! |
Beta Was this translation helpful? Give feedback.
-
Any plans to configure a default per organization? (Especially since the default is the old behavior) |
Beta Was this translation helpful? Give feedback.
-
If you set the merge commit message to |
Beta Was this translation helpful? Give feedback.
-
Our PR template contains markdown comments to provide instructions on what to write in the description. These are not visible in the rendered view so are often left intact by developers, but are undesirable noise in the plaintext commit message. Would you consider adding an option to omit comments from the PR description when used as the default commit message? For example, let's say you have the following PR description:
Enabling the option would generate the following commit message when used with Pull request title and description:
|
Beta Was this translation helpful? Give feedback.
-
It would be really nice to be able to just set a template. The dropdown options right now really aren't self-explanatory. None of them suggest the PR number will be included, which I expected from the blog post title I could finally get rid of… |
Beta Was this translation helpful? Give feedback.
-
When selecting option to use For example many actions such as https://github.com/marketplace/actions/pull-request-ticket-check-action automatically update the PR title. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to configure this via |
Beta Was this translation helpful? Give feedback.
-
tl;dr: It would be nice to be able to select defaults based on PR author. My use case is pretty much to optimize for the case where the merger doesn't edit the merge commit message at all. Using "Default to pull request title and description" gets us pretty far for that, and it can be improved with linters running on the PR description and similar. However, one case that isn't covered and leads to an ugly default is dependabot PRs. The description on a dependabot PR is very, very long, and makes for a terrible commit message. I'm not sure what a great default could be. Maybe the ability to set the behaviour depending on the PR author? If opened by dependabot, then use "Default message", which for dependabot PRs would be the very concise "Bump X from vA.B.C to vX.Y.Z" and some details in the description: And for all other authors use "Default to pull request title and description". |
Beta Was this translation helpful? Give feedback.
-
I would like to request a way to specify boundaries for what to include in the commit message. The use case for our team is that our template includes a checklist of things related to the PR that don't make sense or would be too noisy to be included in the git history. In our case a comment for which everything below is excluded would be sufficient but both begin/end might make sense for completeness. Example: <!-- github-commit-message-begin --> <!-- This line would ideally be optional -->
This is the main description
which we do want in the commit message body.
<!-- github-commit-message-end -->
## Merge checklist
- [ ] This is too much
- [ ] We don't want it in the commit message |
Beta Was this translation helpful? Give feedback.
-
In case of a project that has multiple repositories with different set of branches, PRs and issues, adding a PR number into the commit title by default results in weird references to wrong PRs when the branches between repositories are synced. It would be nice to have an option to remove a PR number from the title:
|
Beta Was this translation helpful? Give feedback.
-
Can we have an option that does not include the PR title? In our org there is typically internal information that we do not want to be carried into the commit messages. As a safety it would be good to not have PR titles into commit messages as an option for all contributors. |
Beta Was this translation helpful? Give feedback.
-
What I'm currently missing is an option to add trailers such as This makes it easier to identify who reviewed or approved a PR by simply checking the git log. |
Beta Was this translation helpful? Give feedback.
-
Would it ever be possible to optionally disable editing the default merge message altogether ? We are trying to keep a clean standard as to what goes into the merged commit message, and that's all doable with workflow runs - we can check the PR title, description, commits and anything else we need. However, the final action of submitting/merging happens after all of the checks have passed, and it gives everyone who merges full control to submit anything they want. |
Beta Was this translation helpful? Give feedback.
-
Could this feature be extended to also affect the commit message prepared when using auto-merge? |
Beta Was this translation helpful? Give feedback.
-
At the moment, the PR number is included in brackets at the end of the title. However, the standard way of linked to things in commit messages is to use trailers. It would be great if there was an option to either configure that or change the default. I'd like to see something like:
|
Beta Was this translation helpful? Give feedback.
-
It would be super helpful if the default could be controlled not just at the repository level but also in specific branch protection rules. |
Beta Was this translation helpful? Give feedback.
-
It would also be great to be able to have the entire URL for the PR in the last line of the commit body (could ideally be set programmatically in a template. The PR number at the top is nice, but when I'm in my terminal and I want to look a commit, I don't have a way to click into and open the PR for that commit. Some IDEs try to provide support for this by having "Issue Navigation" (allowing regex matching on snippets of the commit to create a URL from), but since its at the project level, once I have multiple repos in the same workspace it doesn't know which repo PR (# 123) belongs to. |
Beta Was this translation helpful? Give feedback.
-
I second @BenSluis that there also should be a relation to the rules that can be setup to ensure a certain format for commit messages. For example, we want to ensure with a rule that the commit message for a pull request merge message adheres to be in the format of a conventional commit message. We need this to be able to generate the release notes later automatically with git cliff. So the workflow should be like this:
|
Beta Was this translation helpful? Give feedback.
-
hello @willsmythe I tried out these fields |
Beta Was this translation helpful? Give feedback.
-
This is great! However, I would also like to be able to set a default commit message format for the revert button in the GUI: |
Beta Was this translation helpful? Give feedback.
-
Is it possible to configure this via .github/settings.yml ? |
Beta Was this translation helpful? Give feedback.
-
Is this feature still supported? I can't find this setting anywhere, am I blind? |
Beta Was this translation helpful? Give feedback.
-
This is almost exactly what I need. However, this feature adds While the autogenerated trailers are appropriate (and a nice feature add), the separation of the two sets of trailers breaks commands like Also, as stated above, the PR number added to the title only has context to the original repository and causes confusion in forks. |
Beta Was this translation helpful? Give feedback.
-
Are there any options for using a custom default commit message? |
Beta Was this translation helpful? Give feedback.
-
Voting against putting the PR description into the commit message. Auto-adding the description is often just unnecessary bloat. Do you want a commit message containing this? It's a real, rendered, filled-out example for a perfectly fine PR template of an open source project, but only relevant in the PR review, not in the commit message:
The reason why I upvoted this feedback idea is because users typically just click the merge button, accepting the default commit message without editing, so the default must be minimalistic and reasonable. Only the PR title can be expected to be fine in most cases. Organizations want to avoid committing stuff like this, just because the PR author needed to make a few expected pushes to make CI green, or finish the feature:
Suggestion:
|
Beta Was this translation helpful? Give feedback.
-
I would still very much like to customize the message via some yml file in the headline: Merge pull request {pr.number} from branch {pr.head.ref}
body: |
PR Title: {pr.title}
PR Author: {pr.author}
PR Labels: {pr.labels}
PR Reviewers: {pr.reviewers}
PR Approved by: {pr.reviewers_approved}
PR Assignees: {pr.assignees}
Merged by: {user} This way, I can quickly parse my git history for merging of PRs that had certain labels, or that were reviewed by user X, or merged by user Y. |
Beta Was this translation helpful? Give feedback.
-
We recently shipped more options for customizing the default commit message presented when merging a pull request, including using the pull request's description! The goal is more predictable, consistent, and useful commit messages for your pull requests.
How it works
From repository settings, a user with maintainer or admin access can choose the default format for commit messages produced when merging a pull request.
Learn more about configuring merge commit merging and configuring squash merging.
Thoughts?
Let us know what you think and what would make the feature more useful.
Beta Was this translation helpful? Give feedback.
All reactions