Commit Message Format

Published: (January 7, 2026 at 10:16 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Commit Message Format

Each commit message consists of a header, a body, and a footer. The header has a special format that includes a type, an optional scope, and a subject:

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

The header is mandatory; the scope is optional.

Examplefix: remove unused dependency lodash.camelcase

Any line of the commit message must be no longer than 100 characters. This keeps the message readable in GitHub and various Git tools.

Type

Must be one of the following:

  • feat: A new feature.
  • fix: A bug fix.
  • docs: Documentation only changes.
  • style: Changes that do not affect the meaning of the code (whitespace, formatting, missing semicolons, etc.).
  • refactor: A code change that neither fixes a bug nor adds a feature.
  • perf: A code change that improves performance.
  • test: Adding missing tests.
  • chore: Changes to the build process or auxiliary tools and libraries (e.g., documentation generation).
  • ci: Changes to CI configuration files and scripts.
  • build: Changes that affect the build system or external dependencies (e.g., gulp, broccoli, npm).
  • revert: Reverts a previous commit.
  • wip: Work in progress; the commit may be removed later.

Scope

The scope is optional and can specify the area of the codebase the change affects, e.g., nsis, mac, linux, etc.

Subject

The subject contains a succinct description of the change:

  • Use the imperative, present tense (e.g., “change”, not “changed” or “changes”).
  • Do not capitalize the first letter.
  • Do not end with a period.

Body

  • Write in the imperative, present tense.
  • Explain the motivation for the change and contrast it with the previous behavior.

The footer is used for:

  • Breaking changes – start with BREAKING CHANGE: followed by a space or two newlines.
  • References to GitHub issues that this commit closes (e.g., Closes #123).

Best Practices

  • Write meaningful commit messages – clearly convey what changed and why.
  • Keep commits small – each commit should represent a single logical change.
  • Use branches – create a new branch for each feature or bug fix.
  • Squash commits before merging a feature branch to keep history clean.
  • Review before committing – ensure code follows project standards and passes tests.
  • Automate testing – run automated tests on each commit to catch regressions early.
  • Follow a consistent style – adhere to the project’s style guide for uniformity.

References

Back to Blog

Related posts

Read more »

Git for Beginners

What is Git? Git is a tool that helps you save, track, and manage changes in your code. In simple words: Git remembers every version of your project so you can...

Git Learning

What is Git Git was created by Linus Torvalds in 2005. Version Control Systems Types of Version Control Systems 1. Local VCS - Example: none provided - Limitat...