How do I produce a multiline comment in my git commit using -m
$ git commit -m "This change is for blah"
$ git commit -m "This change is for blah\nAnd also for this blah"
The second line, the \n doesn't produce a multiline comment
I'm using Mac terminal, not sure if that matter.
In many environments (MacOS included) you can just hit enter to end the first line, as long as the quotes for the message are still open.
git commit -m "this is
a multiline
message"
Another option is to compose the message in a file and use -F. (This is a more scriptable alternative to letting a text editor open for the commit message.)
The "multiple -m option' approach others are suggesting kinda-sorta works, but puts blank lines between the messages in my tests.
If you just use
git commit
It will open your editor and allow you to add more complex commit messages.
If you use
git commit -m "This is for blah" -m "This is more text"
it should commit several lines of text.
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