有没有办法为git命令默认设置一个标志? [英] Is there any way to set a flag by default for a git command?
问题描述
每当我运行 git diff
或 git show
时,我都会自动附加 - 忽略-所有空间
。有没有办法做到这一点?我知道我可以创建这样的别名:
$ b
[别名]
sh = show --ignore-all-space
di = diff --ignore-all-space
但我想直接使用 diff
和 show
命令。 p>
我不这么认为: 我没有看到git show的 我无法看到自动设置
$ b
- ignore-all-space
选项
- ignore-all-space
的 git diff
:它必须是作为参数传递。
git diff的一个解决方案至少应该使用 git difftool
。
由于它是一个脚本(在< git> / libexec / git-core
中),您可以修改那个脚本用这个选项总是设置 git diff
。
但是,这可能不是一个好主意,因为它可能导致无视cha甚至没有你,发件人有机会检测和测试。
I would like that whenever I run git diff
or git show
it silently automatically appends --ignore-all-space
. Is there a way to do this? I know that I can create aliases like this:
[alias] sh = show --ignore-all-space di = diff --ignore-all-space
But I would like to use the diff
and show
commands directly.
I do not think so:
I do not see any "
--ignore-all-space
" option for git showI cannot see
git diff
having the--ignore-all-space
set automatically: it has to be passed as argument.
One solution for git diff at least would be to use git difftool
.
Since it is a script (in <git>/libexec/git-core
), you could modify that script to call git diff
with that option always set.
But, that may not prove a good idea, since it can lead to ignore changes that not even you, the sender, had any chance to detect and test.
这篇关于有没有办法为git命令默认设置一个标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!