Git 提交準則
提交訊息格式
<type>(<scope>): <subject in Thai or English>
[optional body]
型別
| 型別 | 使用時機 |
|---|
feat | 新增功能或頁面 |
fix | 修正錯誤 |
refactor | 重構程式碼,不改變行為 |
style | 僅 UI/CSS 變更(無邏輯變動) |
chore | 設定、依賴、工具(如 prisma generate) |
docs | 文件或註解變更 |
perf | 效能改善 |
此專案的範圍對應
| 範圍 | 對應路徑 |
|---|
auth | src/lib/auth.ts、src/lib/auth-client.ts、(auth)/ 路由 |
product | (front)/product/、app-product-card.tsx |
cart | src/lib/cart-store.ts、購物車元件 |
course | (front)/course/、src/services/course-service.ts |
contact | (front)/contact/、src/app/api/contact/ |
prisma | prisma/schema.prisma、src/lib/prisma.ts |
ui | src/components/ui/、src/components/ |
layout | (front)/layout.tsx、(auth)/layout.tsx |
api | src/app/api/ |
config | next.config.ts、prisma.config.ts、.env |
主體規則
- 僅使用英文
- 簡短描述,不超過 72 個字元
- 結尾不需句點
- 使用現在式:「add」、「fix」、「update」,而非「added」、「fixed」
範例
feat(product): add product detail page
fix(cart): fix totalPrice calculation when qty is 0
chore(prisma): regenerate Prisma client after schema changes
style(ui): update badge color in hero component
refactor(auth): extract signIn logic from page component
feat(api): add GET /api/products endpoint with pagination
fix(contact): prevent XSS in email HTML template
注意事項
- 禁止提交
.env 檔案 — 其中包含 BETTER_AUTH_SECRET 和 DATABASE_URL
generated/prisma/ 檔案已加入 gitignore — 無需暫存
- 若修改 schema,必須先執行
npx prisma generate 再提交 schema 檔案
- 未經正當理由,不得使用
--no-verify 跳過 hook
提交前檢查清單