Customize Color of git Output

You can define the way of git output in terms of color, by edit ~/.gitconfig. Here is an example,

  1 [user]
  2     name = xxx
  3     email = xxx@yyy.com
  4 
  5 [color]
  6   diff = auto
  7   status = auto
  8   branch = auto 
  9   interactive = auto
 10   ui = true
 11   pager = true
 12 

For different command, like

git status
git branch 
git diff

you can also specify colors

 13 [color "status"]
 14   added = green 
 15   changed = red bold
 16   untracked = magenta bold
 17 
 18 [color "branch"]
 19   remote = yellow
 20 
 21 [color "diff"]
 22     meta = blue

Precondition for making git color work is, the terminal itself need support colors.

    分享到:

留言

你的邮箱是保密的 必填的信息用*表示