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?
git config --global color.ui auto
For seeing different colors for the diff command, use:
git config --global color.diff true
To globally change colors for most commands, use:
git config --global color.ui true
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.
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:
$ git config --global color.ui 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:
color.branch color.diff color.interactive color.status
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
$ git config --global color.diff.meta "blue black bold"
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
I've used next solution:
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto
git config --global color.diff true git config --global color.status true git config --global color.branch true git config --global color.interactive true
There are 4 settings types available:
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?)
[color] ui = auto [color "branch"] current = auto remote = white reverse [color "diff"] meta = yellow bold frag = magenta bold new = green bold [color "status"] added = yellow bold changed = green untracked = cyan
In modern versions of Git the
colour.ui setting is now
auto by default.
You can use the following as colours:
You can also supply the following optional modifiers:
Note: starting git1.8.4 (June 2013), you won't have to do anything:
Many tutorials teach users to set "color.ui" to "auto" as the first thing after you set "
user.name/email" to introduce yourselves to Git.
Now the variable defaults to "