Last Updated: September 27, 2021
·
2.632K
· jonstaff

Custom Coloring Using .gitconfig

Add some color to your shell by editing your ~/.gitconfig file - it makes everything easier to read, and it's a lot more pleasing to the eye.

Some versions of git come with coloring turned on as default, but if yours is currently dull and single-colored, type the following in terminal for a quick change:

git config --global color.ui auto

If you'd like a bit more customization, open up your ~/.gitconfig in your favorite editor and change the values you want. The following colors are available as options:

- normal
- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white

And the following modifiers are also available:

- bold
- dim
- ul
- blink 
- reverse

Chaining together two colors will set the foreground and background, respectively.

As an example, here's what I use for my coloring:

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