How to write good git commit messages

less than 1 minute read

It’s totally true that the commit messages of a repo become less and less informative as project goes. The article, How to Write a Git Commit Message, gives good guidance to address the issue.

The seven suggestions are,

  1. Use a blank line to separate title.
  2. Don’t use period at the end of the title.
  3. Capitalize the title.
  4. Use imperative mood to write the title.
  5. Keep the title in 50 words.
  6. Wrap the body in 70 words a line.
  7. Use the body to explain what and why instead of how.

Further suggestions are,

  1. Prefer to small checking with [WIP] in title.
  2. Think of your reviewer by review your pull request first to ensure it’s reviewable.
  3. Use git rebase -i HASH to revise and squarsh commits for a releasable feature.