Git (and its ilk) are tools for working collaboratively (especially with hosted services). Your commit messages are your best weapon for communicating context, and every collaborator, including Future You, depends on context to be productive. It’s not opinion, it’s Science!
See, human memory is so bad it can be erased by passing through a doorway. We can defeat doorway-induced time wasting (not to mention the change of screaming “what the hell is this?!” at code someone, maybe Past You, wrote) with great commit messages.
(Image courtesy of XKCD because Randall is a champ.)
A great commit message:
- Is never ‘left behind’ by code changes (unlike comments)
- Gives all the info you need (ticket numbers, reasons for change, expected behaviour changes)
- Shows relevant changes around your change
- Summarises everything in 50 characters or less as the ‘subject line’
All this info, the context of the change, makes problem solving (read: coding) more efficient. Good context helps any collaborator; there’s evidence that context-based approaches to problem solving are more effective.