Left Arrow

Notes

Commit Message Convention

A circle.

Git Commit Message Convention

Tended

Status: decay

Conventional Commits is a convention for adding human and machine readable meaning to commit messages.

Why

  • Improves a team's shared understanding of a codebase by better communicating what a commit did through:
    • structure,
    • clarity (through use of keywords) and
    • consistency.
  • Makes it easier to write automated tools on top of:
    • automatically generating CHANGELOGs,
    • automatically determining a semantic version bump (based on the types of commits landed) and
    • triggering build and publish processes based on commit type.

Structure

The convention structures a commit with 2 mandatory fields and 3 optional.

> <type>[scope]: <description>
> [body]
> [footer(s)]_

Examples

A bug fix

> git commit -m "fix: broken home link"_

A new feature with a breaking change

In Bash, you can use single quotes to write a message on multiple lines.

> git commit -m 'feat: add user-data API endpoint
>
> BREAKING CHANGE: remove user-name endpoint'_

A new feature with scope provided

> git commit -m "feat(user-profile): add user-avatar API endpoint"_
A wizard attempting to open a magic door at the base of a mountain.

Message Keywords

Key WordIndicatesCorrelates with SemVer
buildBuild system changes
ciCI configuration changes
docsDocumentation changes
featIntroduce a new featureMINOR v1.0.0 -> v1.1.0
fixPatch a bugPATCH v1.0.0 -> v1.0.1
perfPerformance improvements
testAdd missing / correct tests
refactor
BREAKING CHANGEIntroduce a breaking API changeMAJOR v1.0.0 -> v2.0.0

Information about SemVer can be found here.

Where to Next?

Web Dev
Git
Arrow pointing downYOU ARE HERE
Commit Message Convention
A sci-fi robot taxi driver with no lower body