0

I'm writing a script that runs git commit. It requires /dev/stdout to be clean for piping/cmd substitution.

I this case, $EDITOR is set to nvim.

$ git commit > /path/to/somewhere
hint: Waiting for your editor to close the file...
<I had to press Ctrl-C>

I recognize that an interactive session while piping is "bad", but I only plan to do this with git commit.

Thank you in advance!!

1 Answer 1

0

git commit needs a commit message in order to work. Normally, it acquires this commit message by prompting you with your editor. However, with standard output redirected, that won't work, so you need to specify a message yourself with the -m option or by setting GIT_EDITOR to the name of a script or command which will edit the file given to it to produce the message.

If your goal was to redirect standard output and have it use your editor, that wouldn't be possible unless your editor were graphical (e.g., gvim -f). Any terminal editor will intrinsically write to standard output as part of running.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .