icdiff 是一个 diff 美化工具。
比如,比较两个文件。
diff 是这样的:
$ diff one two1d0< one3c2< three---> therr5a5> six
而 icdiff 更明显:
$ icdiff one twoone twoonetwo twothree therrfour fourfive fivesix
安装
通过 brew 安装
$ brew install icdiff
通过 pip 安装
$ pip install icdiff
通过包管理器
$ sudo apt-get install icdiff
集成到 Git
可以直接使用:
$ git icdiff
也可以设定 git 预设使用 icdiff 来做差异比对
$ vim ~/.gitconfig[diff]# 使用 icdiff 来取代 git 内建的 diffexternal = ~/bin/git-diff-wrapper.sh
建立 ~/bin/git-diff-wrapper.sh 文件,加入以下内容
$ vim ~/bin/git-diff-wrapper.sh#!/bin/bashicdiff $2 $5
给脚本加上执行权限
$ chmod +x ~/bin/git-diff-wrapper.sh
完成,现在用 git diff 默认是会用 icdiff
## 参考
https://www.zcfy.cc/article/better-git-configuration-scott-nonnenberg-3350.html
https://www.hi-linux.com/posts/43087.html
