Writing Commit Messages
Overview
Every commit message follows a consistent format. The subject line completes the sentence: "If applied, this commit will <your subject line>". When present, the body explains why, not what.
Detect Project Convention First
Follow existing instructions for commits if present in the repository. Check git log --oneline -20 to see recent patterns and match the existing style.
Project convention always wins. The rules below are the default when no convention is detected.
References
Consider the following references when creating new commit messages:
- Subject line rules, body format, URLs, issue references: references/COMMIT_FORMAT.md
- Split strategies, anti-rationalizations, and refactoring patterns: references/ATOMIC_COMMITS.md
- Complete red flags checklist and mistake patterns: references/COMMON_MISTAKES.md
Attribution
Author: Andrew Fontaine (@afontaine)
This skill is based on widely-accepted git commit message conventions, with inspiration from:
- Commit Message Guidelines by Robert Painsi
- OpenStack GitCommitMessages
- A Note About Git Commit Messages by Tim Pope
- How to Write a Git Commit Message by Chris Beams