Good commit message
- Git course
- Beginner
- Lesson 23/80
- 4 min
Learn what makes a good commit message.
Characteristics of a Good Commit Message
A good commit message should be concise, clear, and descriptive of the change. It should make it easy to understand what the change does or why it was made.
Add search filterImperative and Conventional Commits
With the imperative style, a message describes an action, such as Update the menu. Conventional Commits uses types such as feat: and fix: to identify the nature of a change.
feat: add search field
fix: correct login errorPractice Create Conventional Commit Messages
Create two Conventional Commit messages for a new feature and a bug fix. Store them in featureMessage and fixMessage, then print them on separate lines.
Starter code
// Özellik mesajını oluştur
let featureMessage;
// Hata düzeltme mesajını oluştur
let fixMessage;
// Mesajları yazdırSample solution
let featureMessage = 'feat: profil sayfası ekle';
let fixMessage = 'fix: bağlantı hatasını düzelt';
console.log(featureMessage);
console.log(fixMessage);Expected output
feat: profil sayfası ekle fix: bağlantı hatasını düzelt
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which of the following is a better commit message?
- Update
- Files changed
- Add validation to login form Correct answer
- Did some stuff
Explanation: A good message clearly states the change. Generic phrases do not explain its purpose.
2 Complete the Conventional Commits Type
Yeni bir özellik ekleyen commit mesajı ____ ile başlayabilir.
Yeni bir özellik ekleyen commit mesajı feat: ile başlayabilir.
Explanation: <code>feat:</code> is used to identify changes that introduce a new feature.
3 Match Commit Message Principles
| Term | Meaning |
|---|---|
imperative |
Action-oriented wording |
concise |
Remove unnecessary words |
feat: |
New feature type |
fix: |
Bug fix type |