在git config --global interactive.diffFilter diff-highlight
我的.gitconfig
之后:
# This is Git's per-user configuration file.
[user]
name = Vitaly Zdanevich
email = vitaly.zdanevich@xxx.com
[core]
excludesfile = /Users/vitaly/.gitignore_global
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge --skip -- %f
process = git-lfs filter-process --skip
required = true
[diff]
tool = vimdiff
context = 20
[difftool]
prompt = false
[interactive]
diffFilter = diff-highlight
但是在git commit -p
和git add -p
中,我在默认的terminal.app
中看到相同的逐行差异没有颜色:
我也尝试过:
git -c interactive.diffFilter="git diff --color-words" add -p
并获得:
fatal: mismatched output from interactive.diffFilter
hint: Your filter must maintain a one-to-one correspondence
hint: between its input and output lines.
我的git版本是官方命令行工具上的2.17.2 (Apple Git-113)
上的macOS 10.14.1
,我更喜欢简单性,而不是Brew。