git-commit-guide
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Commit Guidelines
Git 提交规范
Commit Message Format
提交信息格式
<type>(<scope>): <subject in Thai or English>
[optional body]<type>(<scope>): <subject in Thai or English>
[optional body]Types
提交类型
| Type | When to use |
|---|---|
| New feature or page added |
| Bug fix |
| Code restructure without behavior change |
| UI/CSS changes only (no logic change) |
| Config, deps, tooling (prisma generate, etc.) |
| Documentation or comment changes |
| Performance improvement |
| 提交类型 | 适用场景 |
|---|---|
| 新增功能或页面 |
| 修复Bug |
| 重构代码(不改变功能) |
| 仅UI/CSS变更(无逻辑改动) |
| 配置、依赖、工具相关变更(如prisma generate等) |
| 文档或注释变更 |
| 性能优化 |
Scopes Matched to This Project
项目对应的提交范围
| Scope | Maps to |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| 范围 | 对应代码位置 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Subject Rules
主题规则
- ใช้อังกฤษเท่านั้น
- ประโยคสั้นๆ ไม่เกิน 72 ตัวอักษร
- ไม่ต้องมี period ท้ายประโยค
- ใช้ present tense: "add", "fix", "update" ไม่ใช่ "added", "fixed"
- ใช้อังกฤษเท่านั้น
- ประโยคสั้นๆ ไม่เกิน 72 ตัวอักษร
- ไม่ต้องมี period ท้ายประโยค
- 使用一般现在时:"add"、"fix"、"update",而非"added"、"fixed"
Examples
示例
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 templatefeat(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 templateGotchas
注意事项
- ห้าม commit ไฟล์ — มี
.envและBETTER_AUTH_SECRETDATABASE_URL - ไฟล์ ถูก gitignore — ไม่ต้อง stage
generated/prisma/ - ถ้าแก้ schema แล้วต้อง ก่อน commit ตัว schema
npx prisma generate - ไม่ใช้ เพื่อข้าม hook โดยไม่มีเหตุผล
--no-verify
- ห้าม commit ไฟล์ — มี
.envและBETTER_AUTH_SECRETDATABASE_URL - 目录已被gitignore — 无需暂存
generated/prisma/ - 如果修改了schema,提交前必须执行
npx prisma generate - 无正当理由不得使用 跳过钩子
--no-verify
Checklist Before Committing
提交前检查清单
- ไม่มีไฟล์ หรือ secret ใน staging area
.env - ผ่านโดยไม่มี error
npm run lint - Type ใหม่อยู่ใน ไม่ใช่ inline ใน component
src/types/ - ไฟล์ชื่อ kebab-case เช่น
product-service.ts
- 暂存区中没有 文件或敏感信息
.env - 执行通过,无错误
npm run lint - 新类型定义在 目录中,而非内联在组件中
src/types/ - 文件名采用kebab-case格式,例如
product-service.ts