Wiki

Clone wiki

petsc / writing-commit-messages

Example

ComponentName: one-line explanation of commit

After a blank line, write a more detailed explanation of the commit.
Many tools do not auto-wrap this part, so wrap paragraph text at a
reasonable length. Commit messages are meant for other people to read,
possibly months or years later, so describe the rationale for the change
in a manner that will make sense later.

If any interfaces have changed, the commit should fix occurrences in
PETSc itself and the message should state its impact on users.

If this affects any known issues, include "fix #ISSUENUMBER" or
"see #ISSUENUM" in the message (without quotes). Bitbucket will create
a link to the issue as well as a link from the issue to this commit,
notifying anyone that was watching the issue. Feel free to link to
mailing list discussions or [petsc-maint #NUMBER].

* Commit messages may contain lists.

* Following these guidelines improves the ability of tools to quickly
  summarize changes according to various criteria.

If other people contributed significantly to a commit, perhaps by
reporting bugs or by writing an initial version of the patch,
acknowledge them using tags at the end of the commit message.

Reported-by: Helpful User <helpful@example.com>
Based-on-patch-by: Original Idea <original@example.com>
Thanks-to: Incremental Improver <improver@example.com>

Merge commits

Do not use -m 'useless merge statement' when performing a merge. Instead, let git merge set up a commit message in your editor. It will look something like this:

Merge branch 'master' into yourname/your-feature

Conflicts:
  path/to/affected/file.c
  other/conflicted/paths.h

(perhaps without a Conflicts section if there are no conflicts). In your editor, add a short description of why you are merging. The final commit can look something like this:

Merge branch 'master' into yourname/your-feature

Obtain symbol visibility (PETSC_INTERN), SNESSetConvergenceHistory()
bug fix, and SNESConvergedDefault() interface change.

Conflicts:
  path/to/affected/file.c
  other/conflicted/paths.h

It should either be to obtain a specific feature or because some major changes affect you. See the Merging section of the Developer Instructions for more on when to use merges. When merging to an integration branch, a short summary of the purpose of the topic branch is useful.

Further reading

http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Updated