有没有办法默认为git命令设置一个标志?

Cha*_*kel 8 git

每当我跑步git diff或者git show它默默地自动追加时我都希望这样--ignore-all-space.有没有办法做到这一点?我知道我可以创建这样的别名:

[alias]
   sh = show --ignore-all-space
   di = diff --ignore-all-space
Run Code Online (Sandbox Code Playgroud)

但我想直接使用diffshow命令.

Von*_*onC 4

我不这么认为:

  • 我没有看到--ignore-all-spacegit show 的任何“”选项

  • 我看不到自动git diff设置--ignore-all-space:它必须作为参数传递。

至少 git diff 的一种解决方案是使用git difftool.
由于它是一个脚本(在<git>/libexec/git-core),因此您可以修改该脚本以git diff在始终设置该选项的情况下进行调用。

但是,这可能不是一个好主意,因为它可能会导致忽略甚至(发送者)也没有机会检测和测试的更改。