Enable git diff-highlight

2016-03-05

The diff-highlight can be a nicer way to review diffs. It tries to highlight changes in a line rather than just display the before/afters. Here's a simple way to setup a simple alias so you can do git d to get the alternate diff.

Code:
// download the diff highlight script from github and put it somewhere relevant (cwd)
curl https://raw.githubusercontent.com/git/git/master/contrib/diff-highlight/diff-highlight > diff-highlight
chmod +x diff-highlight

// add the alias to the global git config
nano ~/.gitconfig


This is what you add in that config:
Code:
[alias]
d = !git diff --color | ~/apps/diff-highlight | more

You can also set it as the default:
Code:
[core]
pager = diff-highlight | more


Source: http://theunixtoolbox.com/git-diff-highlight/