I miss the Git syntax highlighting I had on Windows for every "git .*" command like green staged filenames, some bolding, etc.
How do I enable Git syntax highlighting for Mac's terminal?
I miss the Git syntax highlighting I had on Windows for every "git .*" command like green staged filenames, some bolding, etc.
How do I enable Git syntax highlighting for Mac's terminal?
Note: starting git1.8.4 (June 2013), you won't have to do anything:
For seeing different colors for the diff command, use:
To globally change colors for most commands, use:
I've used next solution:
Original article
I found this excellent blog post that explains how to set up your git colours and what the standard colours are. In summary, add the following lines to your
~/gitconfig
file: (Here's mine - pretty eh?)In modern versions of Git the
colour.ui
setting is nowauto
by default.You can use the following as colours:
normal
,black
,red
,green
,yellow
,blue
,magenta
,cyan
, andwhite
.You can also supply the following optional modifiers:
bold
,dim
,ul
,blink
, andreverse
.Colors in Git
Git can color its output to your terminal, which can help you visually parse the output quickly and easily. A number of options can help you set the coloring to your preference.
color.ui
Git automatically colors most of its output if you ask it to. You can get very specific about what you want colored and how; but to turn on all the default terminal coloring, set color.ui to true:
When that value is set, Git colors its output if the output goes to a terminal. Other possible settings are false, which never colors the output, and always, which sets colors all the time, even if you’re redirecting Git commands to a file or piping them to another command.
You’ll rarely want color.ui = always. In most scenarios, if you want color codes in your redirected output, you can instead pass a --color flag to the Git command to force it to use color codes. The color.ui = true setting is almost always what you’ll want to use.
If you want to be more specific about which commands are colored and how, Git provides verb-specific coloring settings. Each of these can be set to true, false, or always:
In addition, each of these has subsettings you can use to set specific colors for parts of the output, if you want to override each color. For example, to set the meta information in your diff output to blue foreground, black background, and bold text, you can run
You can set the color to any of the following values: normal, black, red, green, yellow, blue, magenta, cyan, or white. If you want an attribute like bold in the previous example, you can choose from bold, dim, ul, blink, and reverse.
See the git config manpage for all the subsettings you can configure, if you want to do that.
Reference : http://git-scm.com/book/ch7-1.html