Git commit, done right
Turn the current working changes into ONE well-scoped commit with a clear message. Read the diff first, never commit blind.
Steps
run_command git status --shortto see what changed. If nothing is changed, say so and stop.run_command git diff(andgit diff --stagedif anything is already staged) and actually read the changes. Understand what they do before writing a word.- If the changes are clearly ONE logical change, stage what belongs to it with
git add -A(or name specific files when some edits are unrelated and should be left out — ask if unsure). - Write the message:
- First line:
<type>: <what changed>, imperative, under ~70 chars. Types: feat, fix, docs, refactor, test, chore, perf, style. - Blank line, then 1-3 short bullets on the WHY when it isn't obvious. Skip the body for trivial changes.
- Describe what the change does, not "updated files".
- First line:
run_command git commit -m "..."(use a real multi-line message when there is a body).- Report the commit's short hash and subject line.
Don't
- Don't commit when
git statusshows nothing staged and nothing to add. - Don't lump unrelated changes into one commit — if the diff spans two separate things, commit them separately or ask.
- Don't invent a message from the filenames — read the actual diff.
- Don't add co-author trailers, emojis, or "generated by" lines unless the user asks.
- Don't
git pushunless the user explicitly says to.