Smart Commit
Analyze current changes and create logical, grouped conventional commits.
Process
- •
Analyze changes
- •Run
git statusto see all modified, added, and untracked files - •Run
git diff(unstaged) andgit diff --cached(staged) to understand all changes - •Run
git log --oneline -5to understand recent commit style
- •Run
- •
Group changes logically
- •Group files by feature, module, or scope (e.g., "product API", "vendor dashboard sidebar", "shared types")
- •Each group becomes one commit
- •A single file can only belong to one group
- •Order groups so dependencies come first (e.g., types before implementation, API before frontend)
- •
Determine commit type for each group
- •
feat:— New feature or functionality - •
fix:— Bug fix - •
refactor:— Code restructuring without behavior change - •
chore:— Build, config, tooling, dependencies - •
docs:— Documentation only - •
test:— Adding or updating tests - •
perf:— Performance improvement - •
style:— Code style/formatting (no logic change)
- •
- •
Present the commit plan
- •Show each group with: commit type, scope, message, and file list
- •Ask for user confirmation before executing
- •Format:
code
Commit 1: feat(product): add product creation API endpoint - apps/gratia-api/src/modules/product/product.constants.ts (new) - apps/gratia-api/src/modules/product/product.validations.ts (new) - apps/gratia-api/src/modules/product/product.repository.ts (modified) ... Commit 2: feat(vendor-dashboard): add product creation form - apps/gratia-vendor-dashboard/src/types/Product.types.ts (new) ...
- •
Execute commits
- •For each group, stage only that group's files with
git add <file1> <file2> ... - •Create the commit with the conventional message
- •Use HEREDOC format for commit messages:
bash
git commit -m "$(cat <<'EOF' feat(scope): short description Optional body with more details. EOF )"
- •For each group, stage only that group's files with
Rules
- •Never use
git add .orgit add -A— always add specific files - •Never commit
.envfiles, credentials, or secrets - •Never amend existing commits unless explicitly asked
- •Never push to remote unless explicitly asked
- •Keep commit messages concise: subject line under 72 characters
- •Use imperative mood: "add feature" not "added feature"
- •If
$ARGUMENTSis provided, use it as guidance for grouping or filtering (e.g., "only API changes", "split frontend and backend")