Search code examples
gitpowershellgit-diff

Changing the color of deleted lines in a diff


When I run the Git diff command from within a Powershell terminal window, the deleted lines are shown in a dark red color on a dark blue background. It is extremely difficult for me to see the actual code.

Is there a Git setting or Powershell setting that will allow me to change this color? Most of the answers I found only deal with the status of the change (modified, staged, etc.) I need to change the color of the deleted line.


Solution

  • There are a collection of git configuration values that control the color output from various commands. In this case you want something like

    git config --global color.diff.old <new-color>
    

    There are a couple ways to specify the color, and this may depend on terminal support. I've had good luck with basic color names in most cases ('blue', 'bold yellow', ...)

    See https://git-scm.com/docs/git-config for additional settings that are available.

    Another option is to suppress color altogether, as in

    git diff --no-color