The diff shows what changed; the message records what it cannot show: why. Git 1,932 's conventions, which tools assume, are short:
A subject of about 50 characters (72 at most) in the imperative ("Add", "Fix"), with no final period.
A blank line, then a body wrapped at 72 characters explaining the reason, when the subject is not enough.
One logical change per commit, so it can be reviewed, reverted or cherry-picked alone.
Commit BookNest's application code with a body that records a design decision, then the tests and README:
git add app.js server.js db public
git commit -F - <<'EOF'
Add the Express API, PostgreSQL layer and front end
BookNest serves its catalog from PostgreSQL rather than a JSON file
so that stock levels can change while the API runs. /health never
touches the database and /ready does, so an orchestrator can restart
a hung process without restarting it for a slow database.
EOF
git add test docker-compose.yml README.md
git commit -qm "Add integration tests, local PostgreSQL and a README"[main 15a2012] Add the Express API, PostgreSQL layer and front end 6 files changed, 260 insertions(+) create mode 100644 app.js ... create mode 100644 server.js
-F - reads the message from standard input; interactively, plain git commit opens core.editor. Messages like "fix" or "wip" cost nothing today and hours in a year, when git log and git blame are all that remain of the reasoning. Conventional Commits adds Conventional Commits prefixes (feat:, fix:) for release tools.