在 OSX 终端中获取 git 颜色

bit*_*onk 13 terminal git macos

我刚刚为 Mac安装了 XCode 和GitHub。我已成功运行“GitHub->安装命令行实用程序”。我可以使用这两个应用程序连接到存储库,并且可以在终端中使用 git 命令。

但是 git 命令不使用任何颜色(就像我在下面的屏幕截图中习惯的那样)。

我该怎么做才能获得颜色(最好直接在 OSX 终端中,但额外的控制台也可以)。

彩色控制台中的 git

use*_*686 14

git config --global color.branch auto
git config --global color.diff auto
git config --global color.status auto
git config --global color.ui auto
Run Code Online (Sandbox Code Playgroud)

全局配置保存到~/.gitconfig,您也可以直接使用文本编辑器进行编辑。

git-config更多选项请参考手册。

  • XCode 4 原生支持 git:http://developer.apple.com/technologies/tools/whats-new.html#version-editor (2认同)