Scoped Commits

A commit format focused on what matters

Scoped Commits is a loose standard for formatting commit messages that focuses on making the commit log quickly understandable to contributors.

Normal commit messages should be formatted as follows:

<scope>: <description>

[optional body]

[optional trailer(s)]

Reverts, merges, and other special commits can be formatted however you like.

Projects using Scoped Commits often provide additional rules defining the valid scopes and how to format the description, body, and trailers of the commit message. Projects may also choose to enforce formatting rules for special commits.

Examples

Linux

i2c: virtio: mark device ready before registering the adapter

View Commit | Formatting Documentation

FreeBSD

linuxulator: Return EINVAL for invalid inotify flags

View Commit | Formatting Documentation

Git

gitlab-ci: update macOS image

View Commit | Formatting Documentation

Go

net/http/cookiejar: add godoc links

View Commit | Formatting Documentation

nixpkgs

xwayland: 24.1.11 -> 24.1.12

View Commit | Formatting Documentation

Why Use Scoped Commits?

The scope of a change (the subject of the change) is the most important part of a commit message. To demonstrate this, let’s consider why each one of the following stakeholders care about the scope of the change:

Scoped Commits puts the most important part of the commit message up front, making it easy for all stakeholders to quickly scan the commit log and identify relevant changes.

FAQ

What about Conventional Commits?

How do I generate a changelog using Scoped Commits?

Don’t. Commit logs and changelogs serve different audiences. Commit logs are for contributors who need to understand how the codebase evolved. Changelogs are for users who need to understand what changed between releases. Here are a number of articles which concur with this point:

What if my commit covers multiple scopes?

If your commit covers multiple scopes, you can try one of the following approaches:

If all else fails, just call the commit a “special commit”, ignore the scope, and write a good description.

How does Scoped Commits handle revert commits?

Revert commits can be formatted however you like. You can use the default Git format for revert commits, or you can use a custom format that includes the scope of the original commit being reverted.

Where should I put the ticket number?

Often, commits need to be associated with a Jira or Linear ticket. This is often done by including the ticket number in the commit message. You can put it anywhere you want within the message, however here are a few suggestions: