Git Commit Messages

— 1 minute read

Let’s talk about git commit messages.

I’m sure you’ve seen or written git commits which aren’t exactly that helpful. The problem is so prevalent, some one has even built a website where you can generate your own horrendous ones.

What we need is a convention to follow. Luckily, there is one called Conventional Commits.

A specification for adding human and machine readable meaning to commit messages.

Types permalink

The most useful part of these conventional commit messages are the types. These are;

  • fix
  • feat
  • chore
  • docs
  • style
  • refactor
  • perf
  • test

So you would write you commit messages in the following format;

git commit -am "test: added tests for a new blog system"
git commit -am "feat: created new blog"
git commit -am "docs: added documentation for creating blog posts"
git commit -am "fix: correct the date format"

You can use a tool such as Commitizen to help you generate these messages.