Better Commit Messages

Conventional Commits

Patterns For Writing Better Git Commits Messages

Automate With CommitiZen CLI

Config CommitiZen CLI as a global utility and use git cz instead of git commit for all commits.

Using CommitiZen With Vim And Vim-Fugitive plugin

In Vim, after staging changes with vim-fugitive, just type :!git cz and the interactive commitizen cli will open and help to compose the commit message.

After that, it will return to Vim and the command :Git push will execute a push to the remote repository.

Writing Commit Messages Without Tools

Use this modified sample template from HelderBurato:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# A properly formed Git commit subject line should always be able to complete
# the following sentence:
#     * If applied, this commit &ltwith your subject line here&gt
#
# ** Example:
# [type](optional scope): [subject]
#
# [optional body]
#
# [optional footer]

# ** Type
# Must be one of the following:
# * build - Build related changes
# * chore - Build process or auxiliary tool changes
# * ci - continuous integration related changes
# * docs - Documentation only changes
# * feat - A new feature
# * fix - A bug fix
# * perf - A code change that improves performance
# * refactor - A code change that neither fixes a bug or adds a feature
# * revert - Reverting things
# * style - Markup, white-space, formatting, missing semi-colons...
# * test - Adding missing tests

# ** Scope
# A scope may be provided to a commit’s type, to provide additional contextual
# information and is contained within parenthesis, e.g., feat(parser): add
# ability to parse arrays.

# ** Subject
# The subject contains a succint description of the change:
# * Use the imperative, present tense: "change" not "changed" nor "changes"
# * No dot (.) at the end.

# ** Body
# Just as in the subject, use the imperative, present tense: "change"
# not "changed" nor "changes". The body should include the motivation for
# the change and contrast this with previous behavior.

# ** Footer
# may contain a BREAKING CHANGE: &lt description &gt
# or information in a convention similar to the one used by git-trailer:
# Fix #42
# See-also: fe3187489d69c4 (subject of related commit)
# Signed-off-by: Alice <alice@example.com>