Files
SuperClaude/.claude/commands/git.md
NomenAK 219ff3905a feat: Optimize all 18 command files using @include reference system
Major streamlining achievement:
- Eliminate 2,733 lines of duplicate content across commands
- Reduce individual command files by ~70% (130-150 → 35-60 lines)
- Leverage existing shared/*.yml reference patterns
- Maintain full Claude Code compliance

Benefits:
• Single source of truth for universal content
• Guaranteed consistency across all commands
• Dramatically reduced maintenance overhead
• Massive token efficiency improvements

Implementation:
- Universal Legend: @include shared/universal-constants.yml#Universal Legend
- Universal Flags: @include shared/flag-inheritance.yml#Universal_Always
- Command patterns: References to appropriate shared/*.yml files
- Template system: Enhanced command-patterns.yml

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24 22:46:52 +02:00

140 lines
2.6 KiB
Markdown

# /git - Manage git workflows and repository operations
## Legend
@include shared/universal-constants.yml#Universal_Legend
## Purpose
Manage comprehensive git workflows for repositories specified in $ARGUMENTS with safety checks and automation.
## Syntax
`/git [flags] [operation/message]`
@include shared/flag-inheritance.yml#Universal_Always
## Core Operations
--commit flag:
- Stage appropriate files
- Generate meaningful commit message
- Include co-author attribution
- Follow conventional commits
--pr flag:
- Create pull request
- Generate PR description
- Set reviewers & labels
- Link related issues
--flow flag:
- feature: Feature branch workflow
- hotfix: Emergency fix workflow
- release: Release branch workflow
- gitflow: Full GitFlow model
## Git Workflows
Feature Development:
```bash
# Start new feature
/git --flow feature "user-authentication"
# Commit progress
/git --commit "Add login form validation"
# Create PR when ready
/git --pr --reviewers @team
```
Hotfix Process:
```bash
# Emergency fix
/git --flow hotfix "security-patch"
# Quick commit & PR
/git --commit --pr "Fix SQL injection vulnerability"
```
Release Management:
```bash
# Start release
/git --flow release "v2.0.0"
# Tag & merge
/git --tag --merge "Release version 2.0.0"
```
## Safety Features
Pre-commit Checks:
- Verify branch is up to date
- Run linters & formatters
- Execute test suite
- Check for secrets
- Validate commit message
Merge Protection:
- Require PR reviews
- Ensure CI passes
- Check branch policies
- Prevent force pushes
- Backup before risky ops
## Advanced Features
--interactive flag:
- Interactive staging (git add -p)
- Commit message editor
- Conflict resolution helper
- Cherry-pick assistance
--history flag:
- Clean up commit history
- Interactive rebase
- Squash related commits
- Reorder for clarity
--stats flag:
- Contribution analytics
- Code churn metrics
- Review turnaround time
- Branch lifetime stats
## Best Practices
Commits:
- Atomic, focused changes
- Present tense messages
- Reference issue numbers
- Co-author attribution
- Sign commits when required
Branches:
- Descriptive names
- Regular rebasing
- Clean before merging
- Delete after merge
- Protect main branches
## Examples
```bash
# Standard commit with message
/git --commit "Add user profile API endpoint"
# Create PR with reviewers
/git --pr --reviewers alice,bob --labels api,feature
# Interactive cleanup before PR
/git --history --interactive
# Full feature workflow
/git --flow feature "payment-integration" --think
```
## Deliverables
- Clean git history
- Meaningful commit messages
- Automated PR creation
- Branch management
- Workflow documentation