cursor-git-commit
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.
When & Why to Use This Skill
This Claude skill streamlines the Git version control process by providing a rigorous pre-commit checklist and staging hygiene workflow. It empowers developers to maintain a clean repository by guiding them through diff reviews, intentional file staging, and the removal of common noise like environment variables or build artifacts, ultimately ensuring high-quality and professional commit histories.
Use Cases
- Scenario 1: Performing a final audit of staged changes to ensure no sensitive information (like .env files) or temporary debugging code is accidentally committed.
- Scenario 2: Cleaning up a messy staging area by selectively unstaging files or removing tracked 'noise' files from the index without deleting them from the local disk.
- Scenario 3: Standardizing a team's commit workflow by following a consistent sequence of status checks, diff reviews, and hash recording.
- Scenario 4: Fixing common Git mistakes immediately after a commit, such as amending a commit message or adding a forgotten file using the provided reset and amend instructions.
| 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.