Format
Struktur Pesan Commit
[optional scope]: [optional body] [optional footer(s)]
Penjelasan Bagian
typeKategori perubahan (feat, fix, dll.)
scopeBagian codebase yang terpengaruh (opsional)
descriptionRingkasan singkat dalam bentuk imperatif
bodyPenjelasan detail (opsional, setelah baris kosong)
footerMetadata seperti BREAKING CHANGE atau referensi issue
Aturan
Bentuk imperatif"add feature" bukan "added feature"
Tipe huruf kecilfeat: bukan Feat:
Tanpa titikDeskripsi tidak diakhiri dengan "."
Baris kosongPisahkan body/footer dari deskripsi
Tipe
Tipe Inti (Relevan SemVer)
featFitur baru (memicu kenaikan versi MINOR)
fixPerbaikan bug (memicu kenaikan versi PATCH)
Tipe Tambahan (Konvensi Umum)
buildSistem build atau dependensi eksternal
choreTugas pemeliharaan (tanpa perubahan src/test)
ciKonfigurasi dan script CI
docsPerubahan dokumentasi saja
perfPeningkatan performa
refactorPerubahan kode yang tidak memperbaiki atau menambah fitur
revertMembalikkan commit sebelumnya
stylePemformatan, whitespace (bukan styling CSS)
testMenambah atau memperbaiki test
Scope
Penggunaan Scope
feat(auth): add OAuth2 login flow fix(parser): handle empty input gracefully docs(readme): update installation steps refactor(api): extract validation middleware
Panduan Scope
Nama modulfeat(auth):, fix(parser):
Nama layerfeat(api):, fix(db):
Area fiturfeat(search):, fix(checkout):
Dependensibuild(deps):, chore(npm):
Tidak perlu scopeGunakan tanpa scope untuk perubahan lintas-modul
Breaking Change
Menandai Breaking Change
feat!: remove deprecated login endpoint feat(api)!: change response format to JSON:API fix!: drop Node 14 support
Breaking Change Gaya Footer
feat(api): change user endpoint response BREAKING CHANGE: response now returns array instead of object. Update client parsing.
Aturan
! setelah type/scopePenanda breaking change singkat
BREAKING CHANGE:Token footer (selalu huruf besar)
BREAKING-CHANGE:Juga valid (bentuk tanda hubung)
Dampak SemVerMemicu kenaikan versi MAJOR
Tipe apapunBreaking change bisa berlaku untuk tipe apapun
Contoh
Commit Sederhana
feat: add email notifications fix: prevent race condition in checkout docs: correct typo in contributing guide style: format with prettier refactor: simplify error handling logic
Dengan Scope
feat(blog): add comment threading fix(auth): refresh token before expiry test(api): add missing edge case coverage ci(github): add Node 20 to test matrix
Dengan Body dan Footer
fix(parser): handle nested quotes correctly Previously, nested quotes caused the parser to enter an infinite loop. This adds a depth counter to prevent unbounded recursion. Closes #234
Footer
Token Footer
BREAKING CHANGE:Mendeskripsikan perubahan API yang breaking
Closes #123Auto-close issue saat merge
Fixes #456Auto-close issue (referensi fix)
Refs #789Referensi issue tanpa menutupnya
Reviewed-by: nameAtribusi reviewer
Co-authored-by: nameAtribusi co-author
Beberapa Footer
feat(api)!: redesign authentication flow Migrate from session-based to JWT auth. BREAKING CHANGE: /auth endpoints changed Closes #101 Refs #98, #99
Tooling
Commit Linting
npm install -D @commitlint/cli \ @commitlint/config-conventional echo "module.exports = { extends: \ ['@commitlint/config-conventional'] }" \ > commitlint.config.js
Tool Populer
commitlintLint pesan commit sesuai konvensi
huskyGit hooks (jalankan commitlint saat commit)
commitizen (cz)Builder pesan commit interaktif
standard-versionChangelog otomatis + kenaikan versi
semantic-releasePipeline rilis otomatis penuh
release-pleaseAlat otomasi rilis dari Google
Setup Commitizen
npm install -D commitizen \ cz-conventional-changelog npx commitizen init cz-conventional-changelog # Use: npx cz (or git cz with alias)
Pola Umum
Pemetaan Kenaikan Versi
fix:PATCH (1.0.0 → 1.0.1)
feat:MINOR (1.0.0 → 1.1.0)
BREAKING CHANGEMAJOR (1.0.0 → 2.0.0)
docs:, style:, dll.Tidak ada kenaikan versi
Pengelompokan Changelog
## [1.2.0] - 2026-03-27 ### Features - add email notifications (abc1234) ### Bug Fixes - prevent race condition (#123) (def5678)
Format Revert
revert: feat(blog): add comment threading This reverts commit abc1234def5678.