Skip to content
Justice Tech School

Empty Commits and Messages

--allow-empty makes a commit with no changes, handy to trigger CI. Multiple -m options add paragraphs.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git commit -q --allow-empty -m 'Trigger build' -m 'Body paragraph'
git log -n 1 --format='%s|%b'

Result

Trigger build|Body paragraph

Exercise

Allow no changes.

git commit ---empty -m x

Quiz Test

What does a second -m add?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.