Git commit using stdout from bash?
You can use the -F <file>, --file=<file>
option.
echo "Test commit" | git commit -F -
Its usage is described in the man page for git commit
:
Take the commit message from the given file. Use - to read the message from the standard input.
You could always write a little function for it:
gcm(){
read message
git commit -m "$message" "$@"
}
Add that to your ~/.bashrc
or equivalent for your shell, and then run:
echo "Test commit" | gcm filename.to.commit
The command above will run
git commit -m "Test commit" filename.to.commit