Tạo PR với commit messages hoàn hảo
Bắt Đầu Nhanh
/git pr
Điều gì sẽ xảy ra:
- Đảm bảo remote được đồng bộ
- So sánh REMOTE branches (không phải local)
- Phân tích nội dung PR thực tế
- Tạo tiêu đề conventional commit
- Tạo PR via GitHub CLI
Kết Quả: GitHub PR URL
Cú Pháp
/git pr [to-branch] [from-branch]
Đối Số
| Đối Số | Mô Tả | Default |
|---|---|---|
to-branch | Target branch | main |
from-branch | Source branch | Current branch |
Ví Dụ
Đầu vào:
/git pr main feature/email-campaigns
Quá trình:
✓ Fetching remote branches...
✓ Pushing feature/email-campaigns to remote...
Analyzing remote diff: origin/main...origin/feature/email-campaigns
Commits (3):
- Add email campaign creation API
- Implement campaign scheduler
- Add campaign analytics dashboard
Files changed (12):
+1,247 lines, -89 lines
Key changes:
- lib/email/campaign.ts (new file)
- lib/email/scheduler.ts (new file)
- app/api/campaigns/route.ts (modified)
- components/CampaignDashboard.tsx (new file)
[... 8 more files]
Generating PR content...
Title: feat(email): add email campaign system with analytics
Body:
## Summary
- Email campaign creation and scheduling
- Trigger-based automation
- Real-time analytics dashboard
## Technical Changes
- Added campaign API endpoints
- Implemented scheduling engine
- Created analytics dashboard component
- Added 12 test cases
## Testing
✓ All tests passing (101/101)
✓ Type-safe
✓ Code reviewed
---
Creating PR...
✓ PR created: https://github.com/yourorg/yourrepo/pull/42
Next: Review PR and merge when ready
Quan Trọng: Remote Comparison
Luôn so sánh REMOTE branches, không phải local:
Đúng:
git diff origin/main...origin/feature-branch
Sai (bao gồm local changes chưa push):
git diff main...HEAD
git diff --cached
git status
Tích Hợp Quy Trình Làm Việc
Sau Implementation
/cook plans/feature.md
# Implementation complete
/git pr # Create PR
Sau /cook
/cook add feature
# User approves
/git pr # Create PR
Custom Branch Flow
/git pr dev # PR to dev branch
/git pr main feature/auth # Specific branches
Yêu Cầu
GitHub CLI
Phải cài đặt gh CLI và được phép hóa:
# Install (macOS)
brew install gh
# Install (Linux)
sudo apt install gh
# Authorize
gh auth login
Nếu gh không có sẵn, hướng dẫn người dùng cài đặt.
Conventional Commits
Tự động tạo tiêu đề theo quy ước:
| Loại | Ví Dụ | Khi |
|---|---|---|
feat | feat(auth): add OAuth support | New feature |
fix | fix(email): resolve send timeout | Bug fix |
docs | docs: update API documentation | Documentation only |
refactor | refactor(db): optimize queries | Code restructure |
test | test(api): add integration tests | Test addition |
chore | chore: update dependencies | Maintenance |
Lệnh Liên Quan
Perfect PRs. Every time. Conventional commit messages tự động tuân theo quy ước.