git diffのカラー設定を変更する
Gitを使用する際に、status、diff、branchの情報を
以下の設定をすることにより、ターミナルのデフォルトカラーで表示することができる。
$ git config --global color.ui true
ただ、これだと僕が使用している、Windows、Solaris、Linux環境では
環境ごとにターミナルのデフォルトカラーが異なった。
WindowsのGit Bashはckwで、SolarisとLinuxはTeraTermという違いは
あるにせよ、TeraTermの設定は同じにしてあるのでLinuxとSolarisは同じになると思ったんだが
色の情報の方が印象が強い。
diffで表示される記号よりも、色の印象の方が強いだろう。
プラットフォームごとに色が違うのは、勘違いしそうだ。
なので、統一したカラー設定に変更したい。
Solarisの青は実際のターミナル上だと僕には読めないし、
Ubuntuの黄色は目にやさしくない。
なので、Windowsの設定をベースにして変更した。
設定内容
.gitconfigに以下を設定
[color "diff"] meta = white bold frag = cyan old = red new = green
参考
- 項目の選択
- color.diff.
Use customized color for diff colorization.
specifies which part of the patch to use the specified color, and is one of plain (context text), meta (metainformation), frag (hunk header), func (function in hunk header), old (removed lines), new (added lines), commit (commit headers), or whitespace (highlighting whitespace errors). The values of these variables may be specified as in color.branch. .
- 色の選択
- color.branch.
- >8 ばっさり 8<----
The value for these configuration variables is a list of colors (at most two) and attributes (at most one), separated by spaces. The colors accepted are normal, black, red, green, yellow, blue, magenta, cyan and white; the attributes are bold, dim, ul, blink and reverse. The first color given is the foreground; the second is the background. The position of the attribute, if any, doesn’t matter.<<