Git commit using stdout from bash

gitpipe

Is it possible to use a commit message from stdout, like:

echo "Test commit" | git commit -

Tried also to echo the message content in .git/COMMIT_EDITMSG, but then running git commit would ask to add changes in mentioned file.

Best Answer

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.

Related Question