Commit
Create a conventional commit from current changes.
Workflow
- •Run
git statusandgit diff(staged + unstaged) in parallel - •Run
git log --oneline -10to match repo's commit style - •Analyze all changes and determine the commit type:
- •
feat- New feature - •
fix- Bug fix - •
refactor- Code restructuring without behavior change - •
docs- Documentation only - •
test- Adding/updating tests - •
chore- Build process, dependencies, tooling - •
perf- Performance improvement - •
ci- CI/CD changes
- •
- •Draft a commit message:
<type>: <description>(1-2 sentences, focus on WHY not WHAT) - •Stage relevant files by name (never use
git add -Aorgit add .) - •Skip files that look like secrets (.env, credentials, tokens)
- •Show the user the proposed commit message and staged files
- •Create the commit using HEREDOC format:
bash
git commit -m "$(cat <<'EOF' type: description EOF )"
Rules
- •Never amend previous commits unless explicitly asked
- •Never push unless explicitly asked
- •Never skip hooks (no --no-verify)
- •Never stage .env files, credentials, or secrets
- •If pre-commit hook fails, fix the issue and create a NEW commit
- •Keep message under 72 characters for the first line