I found these resources very helpful in learning to make better commit messages:
- http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
- http://www.codeography.com/2015/02/17/great_commit_message.html
- http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message
- http://rakeroutes.com/blog/deliberate-git/
The best take away was the because clause. Here is my guidelines (rule of thumbs) that I abide by:
- Subject line is 50 character or less
- Subject starts with a command in present tense: "Fix", "Update", "Refactor", "Move", etc. and not "Fixes" or "Fixed".
- Body is wrapped at 72 characters but don't wrap URL's.
- Body is in Markdown syntax.
- Syntax for bulleted lists should use a hyphen, followed by a single space, with blank lines in between, and a hanging indent.
- Never use
git commit -m
. Instead always open in an editor. This forces you to think about the message and prevents rambling. - When in doubt add the word because to the body and go from there.
- If the code change doesn't warrant a commit message that follows the above then you should concider
rebase
ing it differently. - There are very little exceptions for not including a body. Noteably, a commit that bumps the repo's version number, a non fast-forward merge commit, or a no changes maintinance commit from a bot or script.