Skip to content

Instantly share code, notes, and snippets.

@tuannguyen29
Last active March 10, 2025 02:26
Show Gist options
  • Save tuannguyen29/5552a4bd59530ce8d41195b365c629ae to your computer and use it in GitHub Desktop.
Save tuannguyen29/5552a4bd59530ce8d41195b365c629ae to your computer and use it in GitHub Desktop.
Format title task Jira & Git commit

1. Format title của task trên Jira

[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

Cấu trúc gợi ý

  1. [Project Code] → Mã dự án (AA00, AA01, PP00, PP01)
  2. [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)
  3. [Short Description] → Mô tả ngắn gọn, rõ ràng về nội dung task

2. Format message khi commit lên git

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:

1. Format chuẩn cho commit message

[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

--

2. Các loại commit thường dùng

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

--

3. Format nâng cao (Có task ID trong Jira)

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

--

4. Cách viết message chi tiết

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.

--

5. Các lệnh Git hữu ích

  • 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 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment