git diffのカラー設定を変更する


Gitを使用する際に、status、diff、branchの情報を
以下の設定をすることにより、ターミナルのデフォルトカラーで表示することができる。

$ git config --global color.ui true 


ただ、これだと僕が使用している、WindowsSolarisLinux環境では
環境ごとにターミナルのデフォルトカラーが異なった。
WindowsのGit Bashはckwで、SolarisLinuxTeraTermという違いは
あるにせよ、TeraTermの設定は同じにしてあるのでLinuxSolarisは同じになると思ったんだが


色の情報の方が印象が強い。
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.<<







岡本 隆史、武田 健太郎、相良 幸範
価格: ¥ 2,604


価格は記載時点のものです。購入前にAmazonでご確認ください。





濱野 純(Junio C Hamano)
価格: ¥ 2,310


価格は記載時点のものです。購入前にAmazonでご確認ください。