Write commits that explain why a change was made, so the history stays useful when someone reads it a year later with no memory of the ticket. Use when committing, squashing, or cleaning up a branch before review.
--- name: write-a-good-commit-message category: coding description: >- Write commits that explain why a change was made, so the history stays useful when someone reads it a year later with no memory of the ticket. Use when committing, squashing, or cleaning up a branch before review. --- # Write a Good Commit Message The audience for a commit message is someone in eighteen months trying to work out why a line exists before they delete it. That person cannot see your ticket, your Slack thread, or the state of your head today. `git blame` is the most useful archaeology tool in software, and a history of "fix", "wip", and "address feedback" makes it useless. ## The shape ``` Short summary in the imperative, under ~70 chars Why this change was needed. What was broken, slow, wrong, or missing — the state of the world that made this necessary. What this does about it, if that is not obvious from the diff. Anything a future reader would be surprised by: a trade-off taken, an approach rejected, a constraint that forced this shape. ``` Blank line after the summary. Body wrapped at 72 columns so it reads in a terminal.
You are reading the opening of this skill.
The rest is open to any signed-in account — free included. Reading the library costs nothing.
Shared publicly by the author and open for any use. See the Terms.