Skip to content

Instantly share code, notes, and snippets.

@labynocle
Last active August 29, 2015 14:01
Show Gist options
  • Save labynocle/93b151672585b8511ecd to your computer and use it in GitHub Desktop.
Save labynocle/93b151672585b8511ecd to your computer and use it in GitHub Desktop.
Git: diff-highlight and usual configuration

diff-highlight is a very useful script to enhance git log and git diff commands.

This is just a little memo on how I use it.

diff-highlight

cd ~
[[ ! -e "~/bin" ]] && mkdir bin
cd bin
wget https://raw.githubusercontent.com/git/git/master/contrib/diff-highlight/diff-highlight
chmod +x diff-highlight

I personnaly add ~/bin to the $PATH, so in my ~/.bashrc, I got something like:

PATH="$PATH:~/bin"

git Config

Just add the following line to your ~/.gitconfig:

[alias]
	# my habits
	olog = log -p --color
	plog = log --pretty=format:"%h%x09%an%x09%ad%x09%s"
[color]
	diff = auto
	log = auto
	show = auto
[pager]
	log = diff-highlight | less
	show = diff-highlight | less
	diff = diff-highlight | less

Now enjoy :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment