Enabling Git syntax highlighting for Mac's terminal

前端 未结 7 1568
滥情空心
滥情空心 2021-01-29 21:38

I miss the Git syntax highlighting I had on Windows for every \"git .*\" command like green staged filenames, some bolding, etc.

How do I enable Git syntax highlighting

7条回答
  •  野的像风
    2021-01-29 21:59

    I found this excellent blog post that explains how to set up your git colours and what the standard colours are. In summary, add the following lines to your ~/gitconfig file: (Here's mine - pretty eh?)

    [color]
      ui = auto
    [color "branch"]
      current = auto
      remote = white reverse
    [color "diff"]
      meta = yellow bold
      frag = magenta bold
      new = green bold
    [color "status"]
      added = yellow bold
      changed = green
      untracked = cyan
    

    In modern versions of Git the colour.ui setting is now auto by default.

    You can use the following as colours:

    • normal,
    • black,
    • red,
    • green,
    • yellow,
    • blue,
    • magenta,
    • cyan, and
    • white.

    You can also supply the following optional modifiers:

    • bold,
    • dim,
    • ul,
    • blink, and
    • reverse.

提交回复
热议问题