Rule of Commit Message
แนวทางการพิมพ์ Commit Message ให้อ่านง่าย เป็นมาตรฐานเดียวกัน
👮 Rule
Use the imperative mood
Start with a verb that commands action
"Fix bug in user authentication"
Keep the subject line concise
Limit to 50 characters or less
"Add login validation for user authentication"
Capitalize the subject line
Always start the subject line with a capital letter
"Add login validation for user authentication"
Do not end the subject with a period
Avoid unnecessary punctuation
"Add login validation for user authentication"
Use the body to explain what and why
If not trivial, include a body explaining the changes and the reasons
See below example body
Wrap the body at 72 characters
Ensure readability in various interfaces
"This update ensures all login inputs are validated, providing better user experience and security."
Reference issues and pull requests
Reference related issues or pull requests in the body
"Resolve issue #123"
Use bullet points for lists
If multiple points, use bullet points
See below example body
Use the imperative mood : เริ่มด้วยคำกริยาที่สั่งการกระทำ
Keep the subject line concise : จำกัดให้ไม่เกิน 50 ตัวอักษร
Capitalize the subject line : ใช้ตัวอักษรตัวใหญ่ในการขึ้นต้นหัวข้อเสมอ
Do not end the subject with a period : หลีกเลี่ยงการใช้เครื่องหมายวรรคตอนที่ไม่จำเป็น
Use the body to explain what and why : ถ้าการ Commit ไม่ใช่เรื่องเล็กน้อย ควรมีเนื้อหาอธิบายว่าเปลี่ยนแปลงอะไรและทำไม
Wrap the body at 72 characters : เพื่อให้สามารถอ่านได้ง่ายในหลากหลายอินเตอร์เฟซ
Reference issues and pull requests : หาก Commit เกี่ยวข้องกับ Issue หรือ Pull Request ให้ทำการอ้างอิงในเนื้อหา
Use bullet points for lists : ถ้ามีหลายประเด็น ให้ใช้ Bullet points
📜 Format
Subject Line
Add login validation for user authentication
Body Explanation
Implement input validation for login fields - Add error messages for invalid username and password inputs - Update unit tests to cover new validation logic - Resolve issue #123
Body Details
Previously, users could submit login forms with empty fields, causing errors. This update ensures all login inputs are validated, providing better user experience and security.
📝 Command
✒️ Commit Message Type
📦 build: เมื่อปรับปรุง build config หรือ development tools (เช่น: เกี่ยวข้องกับ npm หรือการเพิ่ม dependencies)
✨ feat: เมื่อเพิ่มคุณสมบัติใหม่ (feature)
💧 chore: เมื่อมีการเปลี่ยนแปลงค่า Ignore หรือค่า Settings ที่ไม่กระทบกับ Code โดยตรง (เช่นที่: .gitignore หรือ .prettierrc)
🐛 fix: เมื่อแก้ไขข้อผิดพลาด (bug fix)
📚 docs: เมื่อเปลี่ยนแปลงที่เกี่ยวข้องกับเอกสาร
♻️ refactor: เมื่อมีการ Refactor code (เช่น การเปลี่ยนชื่อตัวแปร/ ชื่อฟังก์ชัน)
⚡️ perf: เมื่อทำการเพิ่มประสิทธิภาพ (performance)
🍺 style: เมื่อเกี่ยวข้องกับ styling เช่น การจัดรูปแบบใหม่
🙏 test: เมื่อเกี่ยวข้องกับการเขียน Testing เพิ่ม หรือ Refactoring tests โดยที่ไม่เกี่ยวข้องกับ Production code
Last updated