loop/docs/commit-tooling.md
Slyghtning eb63b0b4fe
build: add commit message tooling
Add a repository-local tool to lint, format, and safely reword commit
messages. Preserve markdown lists, quotes, code blocks, and trailers
while enforcing subject and body width limits.

Expose linting, formatting, and rewording through Make targets and
document the supported workflows. Run the linter in CI for pull request
and push commit ranges so malformed messages are caught before merging.
2026-07-22 14:27:25 +02:00

30 lines
856 B
Markdown

# Commit Message Tooling
Use `scripts/commit_message.py` to lint, format, and safely reword commit
messages. The script enforces subject/body wrapping (`69`/`72`), keeps real
newlines, and preserves markdown-like body structure (lists, quotes, fenced
blocks, trailers).
## Common Workflows
```bash
# Lint the current commit message
make commitmsg-lint commit=HEAD
# Lint a commit range
make commitmsg-lint range=upstream/master..HEAD
# Format a message file in place
make commitmsg-fmt file=/tmp/msg inplace=1
# Reword a commit from formatted output
make commitmsg-reword commit=<sha>
# Preview a reword without rewriting history
make commitmsg-reword commit=<sha> dryrun=1
```
## Literal Newlines
If a message was created with literal `\n` sequences, use `decode=1` with
`commitmsg-fmt` or `commitmsg-reword` to convert them to real line breaks.