Skip to content

Commit

Permalink
docs(cursor[rules]): Add git commit message standards
Browse files Browse the repository at this point in the history
why: Establish clear conventions for commit messages and AI assistance

what:
- Created git-commits.mdc with commit format guidelines
- Added commit type definitions and examples
- Included instructions for using Cursor's AI commit features
- Documented best practices for commit message structure

See also: https://docs.cursor.com/context/rules-for-ai
  • Loading branch information
tony committed Feb 22, 2025
1 parent 9a8641c commit 00118ac
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .cursor/rules/git-commits.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
description: git-commits: Git commit message standards and AI assistance
globs: git-commits: Git commit message standards and AI assistance | *.git/* .gitignore .github/* CHANGELOG.md CHANGES.md
---
# Git Commit Standards

## Format
```
type(scope[component]): concise description

why: explanation of necessity/impact
what:
- technical changes made
- keep focused on single topic

refs: #issue-number, breaking changes, links
```

## Commit Types
- `feat`: New features/enhancements
- `fix`: Bug fixes
- `refactor`: Code restructuring
- `docs`: Documentation changes
- `chore`: Maintenance tasks (deps, tooling)
- `test`: Test-related changes
- `style`: Code style/formatting

## Guidelines
- Subject line: max 50 chars
- Body lines: max 72 chars
- Use imperative mood ("Add" not "Added")
- Single topic per commit
- Blank line between subject and body
- Mark breaking changes with "BREAKING:"
- Use "See also:" for external links

## AI Assistance in Cursor
- Stage changes with `git add`
- Use `@commit` to generate initial message
- Review and adjust the generated message
- Ensure it follows format above

## Examples

Good commit:
```
feat(subprocess[run]): Switch to unicode-only text handling

why: Improve consistency and type safety in subprocess handling
what:
- BREAKING: Changed run() to use text=True by default
- Removed console_to_str() helper and encoding logic
- Simplified output handling
- Updated type hints for better safety

refs: #485
See also: https://docs.python.org/3/library/subprocess.html
```

Bad commit:
```
updated some stuff and fixed bugs
```

0 comments on commit 00118ac

Please sign in to comment.