Create an atomic git commit for the changes made in this session.
-
First, run
git statusto see all changes (staged, unstaged, and untracked files). -
Identify only the files you 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: Any path containing brackets
[], parentheses(), or other shell metacharacters must be quoted:git add "src/app/[candidate]/page.tsx" git commit -m "message" -- "src/app/[slug]/page.tsx"
- Use a scoped, descriptive message (e.g.,
feat(auth): add login form,fix(api): handle null response) - Keep the first line under 72 characters
NEVER run these commands unless the user explicitly requests them in writing:
git reset --hardgit checkout <older-commit>git restoreto revert files you didn't authorrmon tracked files- Any destructive operation that could lose work
If unsure, STOP and ask the user before proceeding.
- Run
git status- review what changed - Run
git diff --stagedandgit diff- understand the changes - Identify files from your session only
- Compose a clear commit message
- Execute the appropriate commit command
- Run
git statusagain to verify success