Commit message
- Git course
- Beginner
- Lesson 22/80
- 4 min
Learn to write a meaningful commit message.
Add a Commit Message
A commit message briefly explains what a saved change does. You can provide the message directly in the command with the -m option.
git commit -m "Update the header"Write a Descriptive Message
A commit message should clearly describe the purpose of the change. For example, Add search field is more informative than a generic phrase such as Update.
git commit -m "Add search field"Practice Create a Commit Command with a Message
Use git commit -m to create a command with the message Add form validation. Assign it to saveCommand and print it.
Starter code
// Mesaj içeren komutu oluştur
let saveCommand;
// Komutu yazdırSample solution
let saveCommand = 'git commit -m "Add form validation"';
console.log(saveCommand);Expected output
git commit -m "Add form validation"
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which option is used to provide a commit message in the command?
- -a
- -m Correct answer
- -v
- -p
Explanation: The <code>-m</code> option lets you provide the commit message in the command line.
2 Complete the Message Option
git commit ____ "Menüyü düzenle"
git commit -m "Menüyü düzenle"
Explanation: Use the <code>-m</code> option to provide the commit message directly in the command.
3 Match the Commit Message Parts
| Term | Meaning |
|---|---|
-m |
Message option |
description |
Short description of a change |
git commit |
Save changes |
"Başlığı düzelt" |
Example commit message |