Colorizing output of Git

Apart from various IDEs (including Eclipse) which provide you great Git features visually, accessing Git from command line also can be a new experience which is very useful and from my perspective is a must for any developer that pushes the code in Git (Github, BitBucket, etc.).

Git in terminal is quite amazing and you are able to do everything that you can do visually and much more.

Anyway, let’s back to the main topic. Few days ago, I was in the process of setting up Github for my Centos virtual machine that I have realized that Git commands are not colorized which is quite annoying especially when needs to run git diff command. With little bit of research, I have come across with two solutions which here I describe both.

The first approach is to colorize output of Git commands via configuration. In order to do so, you need to type these commands in terminal,

$ git config --global color.ui auto
$ git config --global color.branch auto
$ git config --global color.status auto

The second approach (more manual) is done by manipulating the config file of Git. You need to edit ‘gitconfig’ file under your home directory (~/.gitconfig) and the few lines,

diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true


Leave a Reply