How to write a good commit message?

A commit message is should be clear and meaningful. Writing good commit messages shows how good a collaborator you are. There are several conventions used by different teams and developers to write good commit messages.

Here is a great template of a good commit message written by Tim pope

Capitalized, short (50 chars or less) summary

More detailed explanatory text, if necessary.  Wrap it to about 72
characters or so.

Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
or "Fixes bug." 

Further paragraphs come after blank lines.

- Bullet points are okay, too

- Typically a hyphen or asterisk is used for the bullet, followed by a
  single space, with blank lines in between, but conventions vary here

- Use a hanging indent

If you use an issue tracker, add a reference(s) to them at the bottom,
like so:

Resolves: #MBNPC-100

The commit type can include the following:

  • feat – a new feature is introduced with the changes
  • fix – a bug fix has occurred
  • chore – changes that do not relate to a fix or feature and don’t modify src or test files (for example updating dependencies)
  • refactor – refactored code that neither fixes a bug nor adds a feature
  • docs – updates to documentation such as the README or other markdown files
  • style – changes that do not affect the meaning of the code, likely related to code formatting such as white space, missing semi-colons, and so on.
  • test – including new or correcting previous tests
  • perf – performance improvements
  • ci – continuous integration related
  • build – changes that affect the build system or external dependencies
  • revert – reverts a previous commit


  • feat: improve performance with lazy load implementation for images
  • chore: update npm dependency to latest version

Read more:

Leave a Comment