Discuss: Fruitful commit message

Hi contributors,

Currently, we merge PRs in pingcap/tidb by ti-chi-bot with empty commit message, and merge PRs in tikv/tikv by ti-chi-bot with simply squash all intermediate messages. Both are less than awesome since we lost all information or mess up every information (with noise).

I’m thinking of a progress to populate fruitful commit message during the merging stage, but still without a complete idea. I post this topic here to see whether we have existing best practice to do so.

Roughly, maybe we can enrich the /merge command to check and fulfill the commit message with pre-defined template. Another thought is let committers merge manually and populate the commit message manually, but it seems hard to archive since our contributors somewhat get used to automation.

Any ideas? Looking forward to your advice.

Best,
tison.

2 Likes

@tison Maybe we should explain what information is needed and why it is needed?

From the current implementation, when we commented on /merge, the commit message has not yet been determined. Finally, the commit obtained by merging PR through squash is configured by the tide component.

  • merge_commit_template : A mapping from org/repo or org to a set of Go templates to use when creating the title and body of merge commits. Go templates are evaluated with a PullRequest (see PullRequest type). This field and map keys are optional.

If what we need is an issue number, we can populate the issue number on the PR title manually, the robot directly uses the pr title as the commit message title.

If we need more information, we should fill in the information in the PR body, and the robot will directly use the PR body as the commit message body.

I don’t see empty commit message? Isn’t the commit message the title of the PR?

Maybe I should elaborate “commit message” means body of commit message.

The fruitful commit message in my mind is like:

but yes, as @Mini256 mentioned above, I should identify what we’re going to include in the commit message. At least optional release note and linked issue should be present IMO.

I thing some handy message:

  1. url link to the PR (so that we don’t need to manually copy the PR id and get to github and compose the URL on our own)
  2. title and url linked to the issue being closed by this PR (if any)

Commit message is basic component of open source workflow requirements. We can learn from other projects, like:

https://docs.djangoproject.com/en/3.2/internals/contributing/committing-code/#committing-guidelines
https://devguide.python.org/pullrequest/#making-good-commits
https://golang.org/doc/contribute?from=from_parent_mindnote#commit_messages
https://github.com/kubernetes/community/blob/master/contributors/guide/contributing.md#code-review

1 Like

Maybe we can use PR body (PR description) as the message body part of the commit generated during squash merge, and use PR title as the message title of the commit.

Before that, we need to make some modifications to the original PR template:

For the PR title, we can fill in the number of the issue related to the PR in the following format, and check it through a bot or CI.

  1. [Fixed #issue-number] pkg [, pkg2, pkg3]: what’s changed
  2. [Fixed #issue-number] *: what’s changed

If the PR has no issue associated with it, we can add the issue-number-none label (by /label issue-number-none command) to remind the bot or CI to skip the issue number check. (Reference from the python community: https://github.com/python/cpython/pull/28228).

When bots merge PR, it will combine PR title and PR number as the commit message title, use PR body directly as commit message body, for example:

In order to filter out unwanted information in the PR body, I submitted a feature issue:

1 Like

About the issue number, I submitted a proposal: