I want to go to the git commit command prompt to add a multi-line message command line in windows. I am able to add commit in a single line using command but I want to add multiple lines of message.
1 Answer
If you want to set a multiline message using -m, just pass in a multiline message as the value of that option. E.g., I can write (assuming a bash shell):
$ git commit -m $'This is\n\nThis is only a test'
And I get:
commit 676ffa32c7adf88e4abafdacf9ba55f9526cd454 (HEAD -> master)
Author: Lars Kellogg-Stedman <[email protected]>
Date: Mon Aug 9 10:52:49 2021 -0400
This is a test
This is only a test
I could also write instead (assuming any posix-y shell):
$ git commit -m 'This is a test
This is only a test'
That results in the same thing.
If you're working with Powershell instead, you can probably do something similar.
git commit -m <msg>wheremsgspans multiple lines?-mvalue on the command line.