Git
使用 ‘diff-highlight’ 表示差異
我已經將diff-highlight設置為 git 的尋呼機/熒光筆。
[pager] log = diff-highlight | less show = diff-highlight | less diff = diff-highlight | less
這完美無缺。
但是如何將 diff-highlight 用於普通 diff ?
您可以定義一個函式:
diff() { /usr/bin/diff "$@" | diff-highlight }
diff-highlight
處理統一的差異(diff -u
)但管道其他格式似乎工作 - 它通過它們不變。為了近似你得到的行為
git diff
,你還需要colordiff
:diff() { colordiff -u "$@" | diff-highlight | less -FRX }