Git Commit
Only commit when the user explicitly asks.
Before committing
Run in parallel:
git status
git diff
git diff --staged
git log -3 --oneline
Safety
- Never update git config
- Never
--no-verify,--force, or destructive git unless explicitly requested - Never commit
.env, credentials, or secrets — warn if requested - Never
git commit --amendunless user asked AND HEAD is yours AND not pushed - If a hook fails, fix and create a new commit (do not amend a failed commit)
- Never push unless explicitly asked
Message
- 1–2 sentences, focus on why
- Match recent
git logstyle (feat/fix/refactor/docs) - Use HEREDOC:
git commit -m "$(cat <<'EOF'
Your message here.
EOF
)"
Steps
- Stage only relevant files
- Commit with message
git statusto verify success