A good commit message is the mark of a professional developer who cares about their team. Imagine you need to track when a bug was introduced into the code, or understand the reason behind a change made two months ago. A poorly written commit history — full of messages like "update", "fix", or "asdfjkl" — makes that tracking nearly impossible. This article covers how to write commit messages that are informative, consistent, and useful.
Why Do Commit Messages Matter?
A commit message isn't just a note for yourself. It's communication with:
- Teammates who have to understand your changes during code review.
- Your future self when debugging a problem that appears months later.
- Automation tools like changelog generators or CI/CD pipelines that read commit messages.
The Basic Format of a Good Commit Message
A good commit message has this structure:
<type>(<scope>): <short description>
[optional body — a more detailed explanation]
[optional footer — issue/ticket reference]
A complete example:
feat(auth): add JWT token validation to the middleware
The token's expiry was previously not validated, so an
expired token could still be used to access endpoints.
Closes #142
This is only part of the article. For the full discussion, with examples and step-by-step details, you can read it on the original source:
How to Write Good Commit Messages in Git
More programming tutorials and developer tools are also available at dhiecoderweb.com.
Top comments (0)