git commit message templates

Improve the quality of commits by providing good templates

git allows you to define custom template for git commits.

While definitely not a new git feature, I encountered it only recently. (Or maybe I encountered it but didn’t have the specific need to be improve the quality within a extended group of people).

What you basically do, is that you provide plain text file with the desired content, and eg. optional help / instructions as comments.

Example:

# <Subject: 50 chars, imperative, no period>

# <Body: Why this change is happening, be self-sufficient.>

#Impact: <major|minor|patch>
#See: <https://...>
#Related: XXX
#Closes: XXX

and then you ask git to use this template with

git config --global commit.template ~/.gitmessage

or alternatively skip --global to use repo-specific configuration.