Skip to content

Summary: Commit hygiene

A commit is a snapshot with intent. The mechanics from L2 plus the discipline from L3 produces a history that earns its existence.

  1. Under 50-72 characters
  2. Imperative mood (Add ..., Fix ..., not Added ... or Adds ...)
  3. Capitalized first letter
  4. No trailing period
  5. Subject answers WHAT; body answers WHY

One logical change per commit. Test: if the subject uses “and”, “also”, “plus”, split into separate commits. The staging area is the tool that lets you do this when working-directory changes are mixed.

<type>(<scope>): <description>
feat: new feature
fix: bug fix
docs: documentation
refactor: code restructure, no behavior change
test: test changes
chore: maintenance
perf: performance
style: formatting only

Adopt when team or open-source project uses it; skip for solo projects unless using semantic-release tooling.

  • Vague verbs (fix, update, WIP)
  • Kitchen-sink commits (many unrelated changes)
  • End-of-day megacommits
  • Fix-the-previous-commit cascades
  • Body-less commits on complex changes

Writing well costs 1 minute. Reading badly costs 1 hour. The math favors writing well by ~60x. Apply this to every commit.

You can now make good commits. L4 teaches how to fix bad ones, git reset vs git revert vs git restore, plus reflog as your safety net.

Git stores snapshots. Every other command is just navigating those snapshots.

A commit is a snapshot with intent. Make snapshots that earn their existence.