DEV Community

Discussion on: How to write a good commit message

Collapse
 
willvincent profile image
Will Vincent

This is pretty much how I've been doing commit messages for the past couple years, since adopting conventional commits and using standard version.

The only difference is my format is like this:
[type]([scope]): [Subject].

and then the optional body, which generally only gets filled out if it's a very large commit (usually a no-no) or is filled in automatically by github on squash & merge of a PR, or if there's a breaking change.

So for example:
feat(Foo): Adds the ability to bar.

fix(Bar): Bar should not prevent Foo.

BREAKING CHANGE: Bar now requires Baz.

Standard Version ingests these commits and automatically compiles a changelog, which we use as part of our deploy process. Result is an automagic changelog created on each production deploy that definitively captures all changes since the last deploy. It's glorious... and simple once you put the pieces in place.

Collapse
 
willvincent profile image
Will Vincent

The benefit of the scope being included is it will group all items by scope, alphabetically, in the changelog, and prefix each of the bulletpoints with that scope value so they're easy to spot.