Changing Default Colors in Git and Posh-Git


Git

In Git, color.status.changedcolor.status.untracked and color.branch.remote, default to red on normal (whatever your console background color is). This can be difficult to read. You can change them using:

git config  "foreground-color background-color attribute"

​For example:

git config --global color.status.changed "yellow normal bold"
git config --global color.status.untracked "yellow normal bold"
git config --global color.branch.remote "yellow normal bold"

Note that “yellow normal dim” will show up as white in PowerShell, so if you want to use yellow, you must also specify bold.

Git-Posh

Git-Posh uses red as the default for GitPromptSettings.WorkingForegroundColor and GitPromptSettings.UntrackedForegroundColor. These are difficult to read as well. They can be changed by editing your PowerShell profile:

  1. From a PowerShell window, type: notepad $profile to edit your profile.
  2. Add the following lines somewhere after the #### end POSH-GIT config line near the end.
$global:GitPromptSettings.WorkingForegroundColor    = [ConsoleColor]::Yellow
$global:GitPromptSettings.UntrackedForegroundColor  = [ConsoleColor]::Yellow

You'll need to restart PowerShell to see the change.

comments powered by Disqus