Skip to main content

Command Palette

Search for a command to run...

Git commit message convention

Published
1 min read

The motivation of this blog is to curate all information in one place and to make more people aware of standards followed by industry.

Let's get started.....

A typical git commit message will look like

<type>(<scope>): <subject>

"type" must be one of the following mentioned below!

  • build: Build related changes (eg: npm related/ adding external dependencies)
  • chore: A code change that external user won't see (eg: change to .gitignore file or .prettierrc file)
  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation related changes
  • refactor: A code that neither fix bug nor adds a feature. (eg: You can use this when there is semantic changes like renaming a variable/ function name)
  • perf: A code that improves performance
  • style: A code that is related to styling
  • test: Adding new test or making changes to existing test

"scope" is optional

Scope must be a noun and it represents the section of the codebase Refer to this link for example related to scope

"subject"

  • use imperative, present tense (eg: use "add" instead of "added" or "adds")
  • don't use dot(.) at the end
  • don't capitalize the first letter

Refer this link for more practical examples of commit messages

References:

  • https://www.conventionalcommits.org/en/v1.0.0/
  • https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716
  • https://github.com/fteem/git-semantic-commits

More from this blog

Just another SRE's blog

7 posts

Buy me coffee buymeacoffee.com/tonyne