name: create-git-commit description: Create an atomic, safe git commit for session-authored changes. Use when users ask to commit changes, make a clean commit, or verify only session files are included.
Atomic Git Commit
Create an atomic git commit for the changes made in this session.
Instructions
- First, run
git statusto see all changes (staged, unstaged, and untracked files). - Identify only the files touched in this session. Do not commit files modified by other agents or processes.
- For tracked files (modified):
git commit -m "<scoped message>" -- path/to/file1 path/to/file2
- For brand-new (untracked) files:
git restore --staged :/ && git add "path/to/file1" "path/to/file2" && git commit -m "<scoped message>" -- path/to/file1 path/to/file2
- Quote paths with special characters:
git add "src/app/[candidate]/page.tsx"git commit -m "message" -- "src/app/[slug]/page.tsx"
Commit Message Format
- Use a scoped, descriptive message (for example:
feat(auth): add login form,fix(api): handle null response). - Keep the first line under 72 characters.
- Do not add AI co-author lines.
Safety Rules - Critical
Never run these commands unless the user explicitly requests them in writing:
git reset --hardgit checkout <older-commit>git restoreto revert files not authored in this sessionrmon tracked files- Any destructive operation that could lose work
If unsure, stop and ask the user before proceeding.
Workflow
- Run
git statusand review what changed. - Run
git diff --stagedandgit diffto understand the changes. - Identify files from this session only.
- Check whether docs need a small update for gotchas, design decisions, or behavior changes.
- Compose a clear commit message.
- Execute the appropriate commit command.
- Run
git statusagain to verify success.