Is there any way to set a flag by default for a git command?

后端 未结 2 1350
不思量自难忘°
不思量自难忘° 2020-12-19 02:43

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

相关标签:
2条回答
  • 2020-12-19 03:13

    Take a look at the core.whitespace configuration variable.

    0 讨论(0)
  • 2020-12-19 03:32

    I do not think so:

    • I do not see any "--ignore-all-space" option for git show

    • I 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.

    0 讨论(0)
提交回复
热议问题