[pager]
log = perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight | less
show = perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight | less
diff = perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight | less
If you want thediff-so-fancy (right side) output but not constrained to files in a git repository, add the following function to your .bashrc to use it on any files:
GIT_HOME='/usr/local/opt/git/' # Use the value from the first step.
ln -s "${GIT_HOME}/share/git-core/contrib/diff-highlight/diff-highlight" \
'/usr/local/bin/diff-highlight'
在 Git 配置中启用它
git config --global interactive.diffFilter diff-highlight # Use on interactive prompts
git config --global pager.diff "diff-highlight | less" # Use on git diff
git config --global pager.log "diff-highlight | less" # Use on git log
git config --global pager.show "diff-highlight | less" # Use on git show