'git' Multiline Commit Messages

Actually, if you just enter the command git commit, an editor is opened where you can enter the commit message.

Alternatively, you can use the -m parameter to specify a commit header message at the command line, or even multiple -m parameters to add several paragraphs. However, this doesn't easily let you insert line breaks in at specific positions of a paragraph.


The following command can be used to "edit" a commit message on the command line, or in a script file:

git commit -F- <<EOF
Header of the message

Body of the message
with preformatted line breaks.
EOF

This is also suitable to specify a message for an annotated tag.


Martin Burnicki martin.burnicki@burnicki.net, last updated 2022-08-10