The output of git fetch
command, is redirected to \"test1
\" file from the below cmd:
manish@rigved:~$ git fetch --all --prune >
You need to redirect stderr in addition of stdout.
git fetch --all --prune > test1 2>&1
More importantly, why a git command does emit information on stderr instead of stdout?
That is specific to git (and not a duplicate of the well-documented stderr redirection).
As I explained here:
It is consistent with the rest of progress reporting within Git.
Reroute the output of stdout to stderr as it is just informative messages, not to be consumed by machines.
You would find on stdout git command outputs that could potentially by used by other commands in a chained-pipe sequence.
Any other message (not meant to be consumed by other commands) is redirected to stderr.