使用对比
git diff
vs git diff --color | diff-so-fancy
安装1
npm install -g diff-so-fancy
安装2(Mac)
brew install diff-so-fancy
可以直接使用
git diff --color | diff-so-fancy
也可以添加到配置里面去
git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"
添加到自己的配置~/.gitconfig
git config --global alias.dsf '!f() { [ -z "$GIT_PREFIX" ] || cd "$GIT_PREFIX" '\ '&& git diff --color "$@" | diff-so-fancy | less --tabs=4 -RFX; }; f'
开源使用
https://github.com/so-fancy/diff-so-fancy