/commit
Stage changes, generate a meaningful commit message, and commit.
Usage
/commit [--all] [--amend] [-m "message"]
What It Does
Analyzes staged and unstaged changes, generates a commit message that summarizes the "why" not just the "what", and creates the commit. Follows conventional commit format when the project uses it.
Implementation
- Analyze changes -- run
git diff --stagedandgit status. - Classify changes -- feature, fix, refactor, docs, test, chore.
- Generate message -- summarize the intent of changes in 1-2 sentences. Use conventional commit prefix if project convention detected.
- Stage (if
--all) -- add all modified tracked files. - Commit -- create the commit with the generated or provided message.
- Verify -- run
git statusto confirm clean state.
Examples
# Commit staged changes with auto-generated message
/commit
# Stage all changes and commit
/commit --all
# Commit with explicit message
/commit -m "fix: resolve race condition in session handler"
# Amend the last commit
/commit --amend