Coloring your Git output
Do you sometimes have a hard time viewing the output of a Git command? Updating the colors might help! In Git, you can edit the config to change the color of the output. You can set colors per repository or globally. We’ll focus on the global config here. The global config can be edited either by using the git config --global
command, or by editing your global .gitconfig
file.
Starting with Git 1.8.4, you can set color.ui auto
which will color the output with the default colors. You’re also able to set the colors manually if you’re so inclined. You are able to edit the colors of the status
, diff
, and branch
commands.
There are 9 colors available:
Color |
---|
normal |
black |
red |
green |
blue |
yellow |
cyan |
magenta |
white |
git config --global color.status.untracked yellow
If you choose to edit the global file manually, the .gitconfig
file can be found at these locations:
OS | Path |
---|---|
Windows (Vista up) | C:/Users/{username}/.gitconfig |
Mac | $HOME/.gitconfig |
Linux | ~/.gitconfig |
[color "diff"]
meta = yellow
frag = magenta
old = red
new = green
[color "status"]
added = yellow
changed = green
untracked = red
[color "branch"]
current = green
local = white
remote = red