The output of the git command is not completely redirected to a file

The output from the git fetch command is redirected to test1 from the cmd below:

 manish@rigved :~$ git fetch --all --prune > test1 From https://github.com/Beawel/wwwnew x [deleted] (none) -> origin/test 

Question However, the string " x [deleted] ... ", as shown in the output, is not redirected to test1, why? Please suggest.

Why did the git command print something that is clearly not an error message on stderr?

 manish@rigved :~$ cat test1 Fetching origin 
+1
source share
1 answer

You need to redirect stderr in addition to stdout.

 git fetch --all --prune > test1 2>&1 

More importantly, why does the git command generate stderr information instead of stdout?
This is typical of git (and not duplication of the well-documented stderr redirection).

As I explained here :

This is consistent with the rest of the Git progress report.
Change the output of stdout to stderr, as these are just informative messages that will not be consumed by the machines.

You can find stdout git commands on the outputs that could potentially be used by other commands in sequence with the chain.
Any other message (not intended for use by other commands) is redirected to stderr.

+2
source

Source: https://habr.com/ru/post/1274867/


All Articles