wiki:CommitMessages

Version 8 (modified by raimue (Rainer Müller), 7 years ago) (diff)

Add TODO for WorkingWithGit#commitmessages

Commit Rules

TODO: This page needs to be merged with WorkingWithGit#commitmessages

General

  1. Mention the names of the affected ports (or state what they have in common if there are too many to list individually), since this information is not visible in the revision log
  2. Be specific about what changes were made (for example, when updating to a new upstream version, mention the version number) and, if it's not completely obvious, why they were made
  3. Reference any tickets that are related to the change, preferably with a Trac link

Using sensible commit messages

When publishing your changes in MacPorts' ports tree, it is good practice to use properly formatted commit messages.

Think about others reading the timeline or viewing git log --oneline. Here you want to see on first glance which port got modified, therefore the recommended format for commit messages is this:

portname: summary, max 50 characters

A longer, optional comment may follow after a blank line, explaining
all of your changes. Git will not wrap paragraphs automatically, so it
is generally recommended to wrap long lines at 72 characters, which is
a limit inherited from email.

Here a reader of MacPorts' timeline can quickly get the most important information, i.e. which port got changed and why.

A real-life example is:

zmq: fix build on macOS 10.12

This fixes a build failure on macOS 10.12 Sierra by backporting a patch
from upstream.

Closes https://trac.macports.org/ticket/40663

References to Trac tickets can only be inserted with the full URL. The '#' syntax is reserved for pull requests on GitHub.

If a change affects multiple ports, list all affected ports. If a change affects a large number of ports, listing their names is not necessary.

Further reading explaining these rules:

Correcting mistakes

If you have already pushed the commit to GitHub, the commit message can no longer be changed. You may add a comment on GitHub to the commit to clarify your mistake.

If you have not yet pushed the commit, and only when you have not yet pushed it, the last commit you made can still be edited with:

git commit --amend

Please note again: this will change the hash of the commit. This can only be used on local commits that were not yet pushed to GitHub.