Another method of adding a multi-line Git commit message is using quotes with your message, though it depends on your shell's capacity. To do this, add single or double quotes before typing the message, keep pressing enter and writing the next line, and finally close the quote at end of the message.
On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter. In your text editor, edit the commit message, and save the commit.
Run git commit
without a message and it'll open up your favorite* text editor to write a commit message. Details on the format of the message will appear in the sample.
First line is the short description. Leave a blank line after it. Everything else is the extended description.
*: for some values of "favorite"; results may vary
From this accepted answer:
git commit -m "Title" -m "Description .........."
Actually, you can do this quite easily from the command line. The trick is to type your message (without a closing quote!) and then hit enter twice, and then type your extended message, close the quote and press enter.
It should look like:
$ git commit -m "Make everything work.
dquote>
dquote> Add magic code that fixes everything"
GitHub will correctly display the top line as your basic message and the bottom line as the extended message.
The following does NOT work. You end up with the literal "\n\n" in the commit message: $ git commit -m "Basic msg\n\nExtend msg, doesnt work"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With