Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 2.04 KB

commit.md

File metadata and controls

45 lines (34 loc) · 2.04 KB
summary Commit rules: message format, the type list, atomic commits, generated files, branches and merges, the changelog
read_when
Getting ready to commit
Writing a commit message or a merge message
Splitting up a set of changes
audience developers

Commit rules

Format

<type>[scope]: <imperative summary>

<optional body: why the change was made, and trade-offs that are not obvious>
  • The summary is at most 72 characters, with no period at the end.
  • type: feat fix docs style refactor perf test build ci chore revert.
  • scope is the package or area, such as engine, libc, gen, driver, docs.
  • For a breaking change, add ! after the type, or write BREAKING CHANGE: at the end of the body.
  • No semicolons, and no dashes as punctuation.
  • No signature or co-author lines.

Atomic commits

  • One commit does one thing, and can be verified and reverted on its own.
  • A behavior change and its tests go in the same commit.
  • Pure refactors, formatting and renames are committed on their own.
  • A change to engine/, to the generator or to scripts/gen-engine.sh goes in the same commit as the generated files it changes, once they are checked in. Never edit generated files by hand.
  • Do not commit build output: .build/, *.test, *.out.

Branches and merges

  • Work on a branch (git switch -c <branch>), not on main.
  • A branch goes into main with a merge commit (git merge --no-ff), whose message is merge: <what the branch does>. git log --first-parent main then reads as the list of changes.
  • Run the checks before every commit.

The changelog

  • A merge that changes what users get (a fix, a new feature, a new limit, a supported target) adds a line under Unreleased in CHANGELOG.md: what changed for the user, not how. Tests, CI, benchmarks and docs get no line.
  • A change that an issue asked for links the issue and thanks the person who opened it.
  • Before a tag, Unreleased becomes vX.Y.Z (date), in its own commit.