Skip to content

Commit Styleguide

Pascal edited this page Nov 23, 2018 · 1 revision

All commit messages should follow this styleguide.

A message consists of up to three parts. The type, the body and the footer. Body and footer are optional.

type: subject
body
footer

The Type

Valid options are:

  • feat: a new feature
  • fix: a bug fix
  • docs: changes to documentation
  • style: formatting according to code styleguide, linting
  • refactor: refactoring production code
  • test: adding tests, refactoring tests, no production code change
  • chore: updating build tasks, package manager configs, etc; no production code change

The Subject

Subjects should be no greater than 50 characters, should begin with a capital letter and do not end with a period.

Use an imperative tone to describe what a commit does, rather than what it did. For example, use change; not changed or changes.

The Body

If the commit is complex, it may be necessary to add a body to the commit message. The body should provide a bit of extra explanation and context. Use the body to explain the what and why of a commit, not the how. Lines of the body should wrap at 72 characters.

The Footer

The footer is optional and can be used to reference and/or close issues. Prepend the footer with a blank line. Lines of the footer should wrap at 72 characters.

Example

fix: Fix problem XY

More detailed explanatory text, if necessary. The text should
not exceed the line width of 72 characters. It is
important to add a blank line before the body as
otherwise various tools could misinterpret the
body as the subject!

Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how (the code should explain
that).
Are there side effects or other unintuitive consequenses of this
change? Here's the place to explain them.

Further paragraphs come after blank lines.

 - Bullet points are okay, too

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

To reference or close issues, reference them at the bottom, like
this:

Resolves: #123
See also: #456, #789

Credits

This styleguide is based on the Udacity Git Commit Message Style Guide

Clone this wiki locally