yasuoza diary

web and life

Kawaii git diff in my local repository

Diff on GitHub is super heart_eyes to me because it shows method name.
This post shows how to make it in local repository.

For example, GitHub shows diff with def is_repo?. Screen Shot 2013-11-21 at 7.17.20 PM.png https://github.com/github/hub/commit/87050ce94a97b0c382b99c975bde0c833332b38e

Normal local diff looks like this confounded Screen Shot 2013-11-21 at 7.20.04 PM.png

The answer is:

.gitattributes
1
*.rb diff=ruby

My local diff is now heart_eyes Screen Shot 2013-11-21 at 7.29.07 PM.png

Following diffs are available.
http://git-scm.com/docs/gitattributes#_defining_a_custom_hunk-header

2013/11/24 UPDATE
If you want to define diffs globally, define like following:

~/.gitconfig
1
2
[core]
      attributesfile = ~/.gitattributes_global
~/.gitattributes_global
1
*.rb diff=ruby

Comments