When a pull request is merged using the merge commit strategy, the resulting merge commit message does not include the source and destination branch names. It should be automatically generated in a format like Merges PR #123 from feature/foo into main so the merge commit is self-documenting and traceable without having to look up the PR.
Scope
This applies only to the merge commit strategy, where a merge commit is actually created.
It does not apply to the rebase strategy, because a rebase replays the source branch commits directly onto the target branch and fast-forwards — no separate commit is created. There is therefore no commit message to enrich in that case. (If traceability is desired for rebases, it would need a different mechanism, such as ensuring the PR reference is included in the original commit messages — that is out of scope for this issue.)
Current Behavior
When merging a PR with the merge strategy, the merge commit message does not explicitly state which source branch was merged into which target branch. Determining this requires looking up the PR details, which is inefficient and hurts traceability, especially in repositories with frequent merges.
Desired Behavior
When a PR is merged via the merge strategy, the generated merge commit message should include both branch names in the following form:
Merges PR #<number> from <source-branch> into <target-branch>
Example:
Merges PR #456 from feature/user-auth into main
This ensures the merge commit is self-documenting and the branch-to-branch relationship is traceable directly from the history.
Acceptance Criteria
Merging a PR with the merge strategy produces a merge commit message containing the PR number, source branch, and target branch.
The rebase strategy is unaffected (no change in behavior, since no merge commit is created).
Existing merge behavior remains backwards-compatible (message format updated, not replaced in a breaking way).
Summary
When a pull request is merged using the merge commit strategy, the resulting merge commit message does not include the source and destination branch names. It should be automatically generated in a format like
Merges PR #123 from feature/foo into mainso the merge commit is self-documenting and traceable without having to look up the PR.Scope
This applies only to the merge commit strategy, where a merge commit is actually created.
It does not apply to the rebase strategy, because a rebase replays the source branch commits directly onto the target branch and fast-forwards — no separate commit is created. There is therefore no commit message to enrich in that case. (If traceability is desired for rebases, it would need a different mechanism, such as ensuring the PR reference is included in the original commit messages — that is out of scope for this issue.)
Current Behavior
When merging a PR with the merge strategy, the merge commit message does not explicitly state which source branch was merged into which target branch. Determining this requires looking up the PR details, which is inefficient and hurts traceability, especially in repositories with frequent merges.
Desired Behavior
When a PR is merged via the merge strategy, the generated merge commit message should include both branch names in the following form:
Example:
This ensures the merge commit is self-documenting and the branch-to-branch relationship is traceable directly from the history.
Acceptance Criteria