cursor-git-commit
提供预提交检查表和暂存卫生(检查差异、暂存特定文件、避免 dist/ 或 .env 等常见噪音,并使用 reset/rm --cached/amend 修复错误)。当用户即将提交、请求提交工作流程或需要帮助清理暂存文件时使用。
📖 中文导读:提供预提交检查表和暂存卫生(检查差异、暂存特定文件、避免 dist/ 或 .env 等常见噪音,并使用 reset/rm --cached/amend 修复错误)。当用户即将提交、请求提交工作流程或需要帮助清理暂存文件时使用。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: cursor-git-commit description: Provide a pre-commit checklist and staging hygiene (review diffs, stage specific files, avoid common noise like dist/ or .env, and fix mistakes with reset/rm --cached/amend). Use when the user is about to commit, asks for a commit workflow, or needs help cleaning up staged files.
Cursor Git Commit
Overview
Use a consistent commit workflow: inspect changes, stage intentionally, and avoid committing noise.
Checklist (run before committing)
- Inspect status:
git status --porcelain - Review diffs:
- unstaged:
git diff --stat - staged:
git diff --cached --stat
- unstaged:
- Stage intentionally:
git add path/to/file ... - Verify staged set:
git diff --cached --name-only - Commit and record hash:
git commit -m "..."thengit rev-parse HEAD
Fix common mistakes
- Unstage one file:
git reset HEAD path/to/file - Unstage everything:
git reset HEAD - Remove noise already committed (keep on disk):
git rm --cached path/to/noisethen add to.gitignoreandgit commit --amend --no-edit
Reference
- Full checklist + ignore guidance:
references/git-commit-instructions.md.