Skip to content

Commit 9207e85

Browse files
committed
refactor(repo): move git command from rules to commands directory and update format
1 parent b47f2f2 commit 9207e85

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
description: Git manipulation rules
3-
globs: *,**/*
4-
alwaysApply: true
2+
description: Git commit creation following conventional commits format
53
---
4+
65
# Commit creation
76

8-
- When asked to "commit":
9-
1. Check staged files using `git diff --staged` and create a commit message using *only* the staged files.
10-
- Once the message is ready, directly propose the commit command to the user.
11-
2. If no files are staged, check the differences using `git status`, then stage files sequentially based on the following commit granularity before committing:
12-
- Separate commits by package.
13-
- Commit dependencies first (if dependency order is unclear, check using `npx lerna list --graph`).
14-
- If the OS, application settings, or context suggest a language other than English is being used, provide a translation and explanation of the commit message in that language immediately before proposing the commit command to the user.
7+
When asked to "commit":
8+
9+
1. Check staged files using `git diff --staged` and create a commit message using _only_ the staged files.
10+
- Once the message is ready, directly propose the commit command to the user.
11+
2. If no files are staged, check the differences using `git status`, then stage files sequentially based on the following commit granularity before committing:
12+
- Separate commits by package.
13+
- Commit dependencies first (if dependency order is unclear, check using `npx lerna list --graph`).
14+
3. If the OS, application settings, or context suggest a language other than English is being used, provide a translation and explanation of the commit message in that language immediately before proposing the commit command to the user.
1515

1616
# Commit message format
1717

@@ -38,20 +38,25 @@ alwaysApply: true
3838
- Always use single quotes (') instead of double quotes (") for commit messages to avoid shell interpretation issues
3939
- For breaking changes or complex commit messages:
4040
- Option 1 (Recommended for complex messages): Use the git commit without -m flag to open an editor:
41+
4142
```
4243
git commit
4344
```
45+
4446
Then write your commit message in the editor with the proper format:
47+
4548
```
4649
type(scope)!: subject line
4750
4851
BREAKING CHANGE: detailed explanation
4952
- Additional details
5053
- More information
5154
```
55+
5256
- Option 2: For command line commits with breaking changes, use a simple format:
5357
```
5458
git commit -m 'type(scope)!: subject line' -m 'BREAKING CHANGE: explanation'
5559
```
60+
5661
- Avoid using special characters like \n in command line commit messages
57-
- For multi-line messages in command line, use multiple -m parameters instead of line breaks
62+
- For multi-line messages in command line, use multiple -m parameters instead of line breaks

0 commit comments

Comments
 (0)