Writing Commit Messages
A good message has a short summary in the imperative mood, such as Add login form. Add a blank line and a longer body when the why matters. Use more than one -m for body paragraphs.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo two >> a.txt && git commit -qam 'Add second line' -m 'Explains why the line is needed.'
git log -1 --format=%s
git log -1 --format=%bResult
Add second line Explains why the line is needed.
Exercise
Add a message inline.
git commit "Add login"
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.