Help yourself write semantic commit messages by adding this template to your git commit template:
# feature: Add beta sequence.
# ^-----^ ^----------------^
# | |
# | +-> Summary in present tense sentence.
# |
# +-------> Type: binary, chore, doc, excise, feature, fix, hack, legal, refactor,
# style, or test.
You can adopt this template without any technical intervention. However, this README will show you how to add so that when git asks for a commit, it'll show something like this:
feature: Add Entropy() convenience method to ArrayTally class.
# feature: Add beta sequence.
# ^-----^ ^----------------^
# | |
# | +-> Summary in present tense sentence.
# |
# +-------> Type: binary, chore, doc, excise, feature, fix, hack, legal, refactor,
# style, or test.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
# modified: Maths/ArrayTally.cs
Copy and paste the above message to ~/.gitmessage or run one of these shell commands.
$ curl https://gist.githubusercontent.com/shanecelis/db3f348288be70e4de4e0f2493f4e3d1/raw/12141f0f2615946d21053ab8e3230a02d18797e5/.gitmessage -o ~/.gitmessage
OR
$ curl -L https://bit.ly/38uuG3C -o ~/.gitmessage; # Same as above with a shortened URL.
$ git config --global commit.template ~/.gitmessage
This guide is really the synthesis of these three articles:
- the semantic commit messages by Jeremy Mack,
- popularized in this best practices article by Sanket on DeepSource, and
- the git commit template tip by Alex Wasik.