gitgit-config

Where can I find all of git's color options?


I want to customise my git colour output.

  1. Where can I find a list of all options for which I can specify the colour?

  2. Where can I find all colours and modifiers that I can set an option to?

Eg, where can I find a complete list of options like:

color.ui
color.branch.current
color.branch.upstream
color.diff.new
color.diff.newMovedAlternative
color.diff-highlight.oldNormal
color.grep.match
color.interactive.help
color.status.untracked

And a list of colors and modifiers like:

blue green red
bold dim blink strike no-bold

Solution

  • All of this is controlled by git config.

    The list of colors is available at color. As explained there, different consoles support different colors. For example in Windows you don't see exactly the same colors in PowerShell, in cmd, or in mingw64 which uses a bash port for Windows.

    There are a lot of colors that can be configured. For example, the colors used when you run git status are here. But there are much more colors, for example for diff, grep, merge, blame... They all have default configurations which I recommend you not to change unless necessary, so that anyone using your git environment, or you using another environment, always see the standard colors.

    If you run git config --get-regexp color you can see the current colors configured in your config files, .gitconfig, but, as explained above, these are only the colors that you have explicitly changed. See the help for the different existing git configuration files: local, global, system (repository, user, machine).