- Install diff-so-fancy via their website (or just run
npm install -g diff-so-fancy
)
- Add the following to your
.gitconfig
file:
[core]
pager = diff-so-fancy | less --tabs=1,5 -R
- I find that these colors work best with it, but it's up to you if you want to add them to your
.gitconfig
or not.
[color "diff"]
meta = "yellow bold"
commit = "green bold"
frag = "magenta bold"
old = "red bold"
new = "green bold"
whitespace = "red reverse"
[color "diff-highlight"]
oldNormal = "red bold"
oldHighlight = "red bold 52"
newNormal = "green bold"
newHighlight = "green bold 22"
Those are colors for ANSI 256 (the 8-bit color version of ANSI escape codes). 22 is a dark green and 52 is a dark red. If you're curious, you can learn more here:
https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit