Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to color the Git console?

I recently saw that the git console in Windows is colored, e.g. Green for additions, red for deletions, etc. How do I color my git console like that?

To install it, I used the command: $ sudo apt-get install git-core

like image 668
MauroPorras Avatar asked Jun 12 '12 14:06

MauroPorras


People also ask

What do the colors mean in git?

Green means the branch is ahead of its remote (green light to push) Red means the branch is behind its remote. Yellow means the branch is both ahead of and behind its remote.

How do I edit Gitconfig?

How to do a git config global edit? The global git config is simply a text file, so it can be edited with whatever text editor you choose. Open, edit global git config, save and close, and the changes will take effect the next time you issue a git command. It's that easy.

How do I change the default git editor?

The command to do this is git config --global core. editor "nano" . You can change the highlighted section with your editor of choice!


1 Answers

As noted by @VonC, color.ui defaults to auto since Git 1.8.4


From the Unix & Linux Stackexchange question How to colorize output of git? and the answer by @Evgeny:

git config --global color.ui auto 

The color.ui is a meta configuration that includes all the various color.* configurations available with git commands. This is explained in-depth in git help config.

So basically it's easier and more future proof than setting the different color.* settings separately.

In-depth explanation from the git config documentation:

color.ui: This variable determines the default value for variables such as color.diff and color.grep that control the use of color per command family. Its scope will expand as more commands learn configuration to set a default for the --color option. Set it to always if you want all output not intended for machine consumption to use color, to true or auto if you want such output to use color when written to the terminal, or to false or never if you prefer git commands not to use color unless enabled explicitly with some other configuration or the --color option.

like image 105
Joel Purra Avatar answered Sep 19 '22 10:09

Joel Purra