Writing commit messages
How to write clear and concise commit messages
Last updated
Was this helpful?
How to write clear and concise commit messages
Last updated
Was this helpful?
A lot of this page is inspired by and adapted from by cbeams.
A well-cared for log is a beautiful and useful thing.
[Good committers] know that a well-crafted Git commit message is the best way to communicate context about a change to fellow developers (and indeed to their future selves)
β
These are just some useful guidelines, not rules.
Not every commit requires both a subject and a body. If the subject is enough, it's enough.
But when you do need to provide more detail, separate the subject from the body with a blank line.
This isn't a rule, but it encourages you to be concise. It also means that the subject will be presented nicely in most places without being trimmed.
Readability starts with first principles, but...
Every character counts when you're being concise.
Write like you're commanding someone to do something, not past tense expressing what you did.
This is possibly the most important recommendation!
When committing many changes, you should focus on giving context on what has changed and why it was needed, and less on how.
For most content changes this probably won't be a major concern, but if your changes cover code, then the how can usually be found by reading the changes in the code; what may be less obvious from the code is what changed and why.