Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get colored output with git+mintty+mingw on windows?

I have installed the official windows git distribution, and I installed a recent mingw, and into that the mintty terminal. Then I have copied my git installation to this mingw installation, and now it works from within mintty. My only problem is that the git output is not colored. I suspect that this is because the windows git port tries to use the windows console color thingie and not the ANSI color codes which mintty would be able to interpret. Is it possible to make git use the ANSI color codes instead?

(I have tried a cygwin setup prior to this, but the performance was very, very bad, and I could not find any solution to that).

like image 244
Tamás Szelei Avatar asked Feb 26 '13 14:02

Tamás Szelei


2 Answers

from git-config:

If this is set to always, git-diff(1), git-log(1), and git-show(1) will use color for all patches. If it is set to true or auto, those commands will only use color when output is to the terminal. Defaults to false.

It looks like git isn't treat mintty as terminal. For me using always instead of true/auto helps:

[color]
  status = always

Forcing color by adding --color flag to diff command work as well (with diff=true):

git diff --color 
like image 192
pawcik Avatar answered Nov 07 '22 10:11

pawcik


It's simple. Config git to always show color in any ui.

git config --global color.ui always

Works for me.

like image 38
Valmir Avatar answered Nov 07 '22 11:11

Valmir