Sub topic 2
Writing Clear Conventional Commit Messages
Assume you know basic Git commands, can edit a commit message, and understand MAJOR.MINOR.PATCH versioning. This chapter focuses on descriptions, bodies, footers, and breaking-change markers.
Write a Clear, Short Description
The description is the first-line summary after the type and optional scope. Write it as an imperative phrase that states the result of the change:
fix(parser): reject empty expressions
feat(api): add pagination to user searches
docs: clarify installation stepsKeep the description specific and short. Avoid vague phrases such as “update code” or “fix issue.” Do not end it with a period. The first line should usually fit within 72 characters so that it remains readable in Git logs and pull-request lists.
Use a Body and Footers
Add a blank line after the description before writing a body. The body explains why the change was needed, important design decisions, or behavior that is not obvious from the first line.
Footers come after another blank line. A footer uses a token, a colon, and a value. Teams commonly use footers for issue references, reviewers, or change metadata.
feat(parser): support array literals
The parser now accepts [1, 2, 3] and creates an ArrayNode.
This keeps array syntax consistent with object literals.
Refs: #482A body is useful when future readers need context. A footer is useful when tools or people need structured information. Keep the first line useful by itself.
Flag Breaking Changes
A breaking change requires users to modify their code or workflow. Mark it with ! before the colon:
feat(api)!: remove the deprecated v1 users endpointYou can also add a BREAKING CHANGE footer that explains the migration:
feat(api): remove the deprecated v1 users endpoint
BREAKING CHANGE: clients must call /v2/users instead.Using both markers makes the change visible to people and release tools. A breaking change normally maps to a MAJOR version under Semantic Versioning.
Exercise
Write a commit message for adding CSV export to the reports module, including an issue reference.
Show answer
feat(reports): add CSV export Users can download report data as CSV. Refs: #214