Skip to content

Commit 1ce3c75

Browse files
committed
chore(cursor): add rules for git related to terminal
1 parent 88efeae commit 1ce3c75

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.cursor/rules/git-commands.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Git Commands
2+
3+
Always use `--no-abbrev-commit` and proper formatting flags for all git terminal commands to avoid shell parsing issues.
4+
5+
## Specific Commands to Use:
6+
7+
**Instead of:**
8+
```bash
9+
git log --oneline
10+
git show --stat HEAD
11+
git branch -v
12+
```
13+
14+
**Use:**
15+
```bash
16+
git log --pretty=format:"%h %s" --no-abbrev-commit
17+
git show --stat --no-abbrev-commit HEAD
18+
git branch --show-current
19+
```
20+
21+
## Key Flags:
22+
- `--no-abbrev-commit` - Prevents abbreviated commit hashes
23+
- `--pretty=format:"..."` - Use explicit formatting
24+
- `--porcelain` - For cleaner output when available
25+
- `--no-color` - Remove ANSI color codes
26+
- `--show-current` - For branch operations
27+
28+
## Common Patterns:
29+
- `git log master..HEAD``git log --pretty=format:"%h %s" --no-abbrev-commit master..HEAD`
30+
- `git status``git status --porcelain`
31+
- `git diff --name-only master``git diff --name-only master`

0 commit comments

Comments
 (0)