How to read output from git pull –stat with colors into variable
Escaped sequences from
ls --color=always are easily read into
- git fetch --quiet is writing to stdout instead of bieng silent
- Git: unable to redirect/parse the output of 'git fetch --dry-run' command
- git commands not respecting io redirection
- Redirect all output to file
- Trying to redirect 'git gc' output
- How to suppress stderr output in Powershell?
$ output=$(ls --color=always) $ echo -e "$output"
But not from
git pull --stat:
$ git config color.ui always $ output=$(git pull --stat <repository> <refspec>) $ echo -e "$output"
In other words, how can I trick
git pull into thinking that it is not going to output into a variable? This does not work:
$ env TERM=xterm-color git pull --stat.
One Solution collect form web for “How to read output from git pull –stat with colors into variable”
You have a typo in your config variable, it should be
color.ui, singular, not
On my system with git version 1.7.10 it then works as expected.
Update: see screenshot: