Skip to content

How to write commit messages

Roel Baars edited this page Nov 23, 2018 · 1 revision

Originally posted here:

Some commit and merge messages are of the type "Fixes #123", "Handles request from Bob in the forum" or "Merge pull request #123 from remote". I would like to remind you to please take a few seconds to make sure that your commit and merge messages convey useful info without having to read through references issues or forum topics. There are almost 600 commits between tag 5.3 and current HEAD, and having to crosscheck issues and forum topics to figure out what a patch does is very time-consuming.

Commits which do cryptic C++ stuff of course don't need to be explained in layman English - much of the time that's not even possible - but it would help if the commit message hinted at the commit doing something C++/math-related which is not "of interest to photographers".

A general note about git commit messages - I will quote from the Git handbook:

As a general rule, your messages should start with a single line that’s no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. The Git project requires that the more detailed explanation include your motivation for the change and contrast its implementation with previous behavior – this is a good guideline to follow. It’s also a good idea to use the imperative present tense in these messages. In other words, use commands. Instead of “I added tests for” or “Adding tests for,” use “Add tests for.”

More info and an example: https://git-scm.com/book/gr/v2/Distributed-Git-Contributing-to-a-Project#_commit_guidelines

Clone this wiki locally