10

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).

Tamás Szelei
  • 21,352
  • 16
  • 94
  • 169
  • 1
    From my experience Cygwin and Mingw are about equally bad in terms of performance. In particular, having a clean `PATH` variable helps a lot. – Rufflewind Mar 03 '15 at 02:32

2 Answers2

9

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 
pawcik
  • 305
  • 2
  • 11
  • Indeed, it seems that putting `always` solves the issue. I had a working color setup with the shell shipped with msysgit (which is a standard Windows shell running `sh.exe --login -i`). Putting `always` instead of true in my `~/.gitconfig` file fix the no color problem with `mintty`. Thank you – Matt Sep 11 '13 at 16:03
  • 3
    This doesn't completely work, for example `git branch`. I also had to set branch, diff, and interactive to 'always' in addition to status. – Greg Ennis Mar 07 '14 at 11:11
1

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

git config --global color.ui always

Works for me.

Valmir
  • 136
  • 4