Git Commit Message yang Baik
GitBest PracticesVersion Control
Commit message yang baik harus menjawab:
Apa yang berubah? Dan kenapa?
✅ Format Umum (Recommended)
<type>: <short description>
Contoh:
feat: add user authentication
fix: handle null pointer on login
refactor: simplify order validation logic
🔖 Commit Types (Paling Umum)
- feat → fitur baru
- fix → bug fix
- refactor → perbaikan struktur tanpa ubah behavior
- docs → dokumentasi saja
- test → menambah / memperbaiki test
- chore → config, dependency, tooling
- perf → optimasi performa
📝 Aturan Penting
-
Gunakan imperative mood
- ✅
add login endpoint - ❌
added login endpoint
- ✅
-
Huruf kecil di awal
-
Maksimal 50 karakter untuk subject
-
Jangan pakai titik di akhir
❌ Contoh Commit Message Buruk
update
fix bug
wip
final
Tidak jelas dan tidak informatif.
✅ Contoh Commit Message Baik
feat: create REST API for products
fix: prevent duplicate email registration
refactor: remove nested conditional logic
docs: add API usage example
🎯 Rule of Thumb
Jika commit message dibaca 6 bulan kemudian, orang lain (atau kamu sendiri) tetap paham apa yang terjadi.