I understand that the following command takes the text from standard input and uses it as the message for the commit log:
echo "hello world" | git commit -F -
git commit -F -
(reading log message from standard input)
When you use - in commands it tells the application to read from STDIN. Git notices that STDIN is empty (unless you echo and pipe first) so it starts listening for input. Once you type your message you have to tell it that you're finished by sending the EOF message.
When you run echo hello | git commit -F - you're piping text into git so it uses the piped message.
In order to use
git commit -F - on Windows in the Git Bash console, you must append the command to
winpty as so:
winpty git commit -F -
Afterwards, you will be taken to "standard input mode" as expected. Instead of using CTRL + D as you would with Linux and Mac, press CTRL + Z and then ENTER on a new line. This will indicate an EOF and save the commit log message.
If you press CTRL + Z on the same line as the message, then
^Z will be entered as text next to the message and nothing else will happen. You need to press CTRL + Z and then ENTER on a separate and empty line.
So, to edit blockloop's example:
winpty git commit -F - my message blah blah<enter> <CTRL-Z><enter>