/commit - Standardized Commit Workflow
Pre-Flight
git branch --show-current— wrong branch? STOP and ask usergit status && git diff --cached --stat— review what will be committed- Nothing staged?
git add -uor add specific files
Auto-Format Python (before committing)
STAGED_PY=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$')
if [ -n "$STAGED_PY" ]; then
BLACK=$(command -v black)
echo "$STAGED_PY" | tr '\n' '\0' | xargs -0 "$BLACK" --line-length=88 --quiet
echo "$STAGED_PY" | tr '\n' '\0' | xargs -0 isort --profile black --quiet
git add -u
fi
Commit
git commit -m "<type>(scope): <description> (#<issue-number>)"
- Types:
feat,fix,chore,refactor,docs,style,test - Always include issue number
- NEVER include
Co-Authored-Bytrailer
Hook Retry (if commit fails due to reformatting)
git add -u && git commit -m "<same message>"
- Max 3 retries; if still failing after 3, stop and report
Verify
git log -1 --stat— confirm correct message and files
CI Check (if PR exists)
gh pr checks
- Fix failures before marking issue
done; never markdonewith red CI
Red Flags — STOP
- Wrong branch
- 3+ hook retry failures
- Unrelated changes mixed in one commit