How do you customize the color of the diff header in git diff?

后端 未结 2 1743
抹茶落季
抹茶落季 2020-12-31 02:29

When I run git diff, the header part of each diff comes out in white text. Since I\'m using a light background it is hard to read, so I want to change it.

2条回答
  •  失恋的感觉
    2020-12-31 02:56

    Try setting color.diff.meta, e.g.

    git config --global color.diff.meta blue
    

    or by manually editing the configuration file

    [color "diff"]
        meta = blue
    

    You can look through the various color. settings in the git-config reference for more possible settings. The color.diff.meta setting is listed here:

    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..

提交回复
热议问题