如何在Ubuntu的颜色的Git控制台? [英] How to color the Git console in Ubuntu?

查看:199
本文介绍了如何在Ubuntu的颜色的Git控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近看到,Windows中的Git控制台是彩色的,例如。

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 Ubuntu Git console like that?

要安装它,我使用命令: $ sudo apt-get install git-core

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

推荐答案

As @VonC color.ui 默认为 auto ,因为git 1.8.4。不是太快发布)

As noted by @VonC, color.ui defaults to auto since git 1.8.4. Not a release too soon ;)

从Unix& Linux Stackexchange问​​题如何对git的输出进行着色由@Evgeny回答

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

git config --global color.ui auto




color.ui 是一个元配置,包括所有各种 color。* git 命令。这在 git help config 中深入解释。

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.

分别设置不同的 color。* 设置,更容易和更好的未来证明。

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

a href =http://www.kernel.org/pub/software/scm/git/docs/git-config.html> git config 文档:

In-depth explanation from the git config documentation:


color.ui :此变量确定控制每个命令族使用颜色的变量(例如 color.diff color.grep )的默认值。其范围将扩展,因为更多的命令学习配置为 - color 选项设置默认值。如果您希望所有输出不适用于机器消耗,请将其设置为总是> true auto 如果您希望此类输出在写入终端时使用颜色,或者 false / code>如果你喜欢git命令不使用颜色,除非用一些其他配置或 - color 选项显式启用。

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.

这篇关于如何在Ubuntu的颜色的Git控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆