[Project Code] - [Task Type] - [Short Description]
Ví dụ:
✅ [AA00][Bug] - Fix SQL Injection in Login
✅ [AA01][Feature] - Implement User Role Management
✅ [PP00][Task] - Convert PSD to HTML for Homepage
✅ [PP01][Improvement] - Optimize Phalcon Query Performance
- [Project Code] → Mã dự án (AA00, AA01, PP00, PP01)
- [Task Type] → Loại công việc:
Bug
(Sửa lỗi)Feature
(Tính năng mới)Task
(Công việc chung)Improvement
(Cải tiến)
- [Short Description] → Mô tả ngắn gọn, rõ ràng về nội dung task
Có chứ! Một quy tắc đặt message khi commit giúp codebase rõ ràng, dễ quản lý, đặc biệt khi làm việc nhóm. Tuấn có thể áp dụng format này:
[type]: [Short Description]
Ví dụ:
✅ feat: add user login API
✅ fix: resolve SQL injection in login
✅ refactor: optimize database queries
✅ docs: update README with installation steps
✅ chore: update .gitignore file
--
Type | Ý nghĩa |
---|---|
feat |
Thêm tính năng mới |
fix |
Sửa lỗi |
refactor |
Cải thiện code (không thay đổi tính năng) |
docs |
Cập nhật tài liệu |
style |
Chỉnh sửa format, indent, dấu cách (không ảnh hưởng logic) |
test |
Thêm/chỉnh sửa test cases |
chore |
Công việc lặt vặt (cấu hình, build script...) |
perf |
Cải thiện hiệu suất |
--
Nếu muốn liên kết với Jira task, có thể thêm [Project Code] + Task ID:
[type]([Project-Code]-[Task-ID]): [Short Description]
Ví dụ:
✅ feat(AA00-123): implement user authentication
✅ fix(PP01-456): correct UI alignment in dashboard
--
Message commit có thể có nhiều dòng, ví dụ:
feat: implement JWT authentication
- Add JWT middleware
- Store refresh token securely
- Update user model with token expiry
⚡ Lợi ích: Dễ đọc, dễ theo dõi thay đổi khi review.
--
- Kiểm tra log commit theo format đẹp:
git log --oneline --decorate --graph --all
- Chỉnh sửa commit gần nhất:
git commit --amend -m "feat: improve token validation"
- Push commit bị sửa đổi (force push):
git push origin branch-name --force
🚀 Tuấn 😃