Use this rule when you need to create a commit for staged changes, following the project's conventional commit format as outlined in CONTRIBUTING.md.
The project requires conventional commit format for PR titles, and it's good practice to use it for individual commits as well.
- First, stage all files using
git add .to ensure all changes are included - Check what files are staged using
git status --porcelain(avoidgit statusalone as it can be verbose) - If you need to see changes, use
git diff --cached --name-onlyfor file list orgit diff --cached --statfor summary - If you need to see actual diff content, use
git diff --cached | catto avoid paging issues - Analyse the staged changes to understand what type of work was done
- Determine the appropriate conventional commit type:
featfor new featuresfixfor bug fixesdocordocsfor documentation changesrefactorfor code refactoringconfigfor configuration changesdbfor database schema changesdepsfor dependency changesrepofor repository structure changesstylefor formatting changestestfor adding or fixing testschorefor maintenance tasks
- Determine if a scope is appropriate (optional but helpful for clarity)
- Write a commit message in the format:
type(scope): descriptionortype: description - Keep the description concise but descriptive of what was changed
- Use present tense and imperative mood (e.g., "add", "fix", "update")
- Run
git commit -m "commit message" - If the user requested "commit and push", also run
git pushafter the commit
Example: git commit -m "doc: restructure LLM documentation system"
- Using past tense in commit messages (e.g., "added" instead of "add")
- Making commit messages too vague or too detailed
- Including a verbose bullet-point list of changes as the body of the commit
- Forgetting to stage all files before committing
- Using commands that produce paged output like
git diff,git log, orgit showwithout| cat
- Use Australian/NZ English spelling (e.g., "organise", "colour", "centre") instead of American English (e.g., "organize", "color", "center")
- Always stage all changes before committing to ensure consistency
- When user says "commit and push", perform both operations in sequence
- Commit incrementally instead of making large changesets whenever possible