Git commit messages are important. We all know that, yet ... in the heat of the moment, we're prone to this non-sense:
git commit -m "stuff"
git commit -m "fix"
git commit -m "it'll work this time!"
Any of them look familiar? You bet your ass they do.
This is nice and easy. First, create a text file for your template inside your
~/.config/git directory (
~/.git/ on macOS I think).
# ~/.config/git/commit.txt My Commit Template
Then update your Git configuration. You can do this one of 2 ways:
git config --global commit.template ~/.config/git/commit.txt
Or you can update your configuration file:
Now that you've got a simple template. What should you put there?
Let me introduce you to Conventional Commits.
You can find my template here.
The following is the summary and some examples from the website linked above.
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
The commit message should be structured as follows:
<type>[optional scope]: <description> [optional body] [optional footer(s)]
feat: allow provided config object to extend other configs BREAKING CHANGE: `extends` key in config file is now used for extending other config files
refactor!: drop support for Node 6
docs: correct spelling of CHANGELOG
feat(lang): add polish language
fix: correct minor typos in code see the issue for details on typos fixed. Reviewed-by: Z Refs #133