git log --exit-code是什么意思?

Alo*_*dal 7 git command-line-interface

git-log手册页介绍了--check与不相容选项--exit-code选项.我想知道这--exit-code意味着什么,但我无法在任何地方找到它.我已经尝试了man git log,man git谷歌并在这里直接搜索SO ...无济于事!

什么--exit-code意思git log

jub*_*0bs 8

TL; DR

我想知道这--exit-code意味着什么[...]

--exit-code是一个diff-*1选项,1如果有更改,则使Git命令退出,0否则.

[...]但我无法在任何地方找到它.

您可以在git-diff手册页中阅读它(它仅在git-log手册页中提及).

更多细节

无论--check并且--exit-code在描述git-diff手册页(更具体地说,在Documentation/diff-options.txt):

   --check
 Warn if changes introduce whitespace errors. What are considered
 whitespace errors is controlled by core.whitespace configuration.
 By default, trailing whitespaces (including lines that solely
 consist of whitespaces) and a space character that is immediately
 followed by a tab character inside the initial indent of the line
 are considered whitespace errors. Exits with non-zero status if
 problems are found. Not compatible with --exit-code.
Run Code Online (Sandbox Code Playgroud)

   --exit-code
 Make the program exit with codes similar to diff(1). That is, it
 exits with 1 if there were differences and 0 means no differences.
Run Code Online (Sandbox Code Playgroud)

一些(但不是全部)diff-*选项与之兼容git-log.该--check选项,而--exit-code选择并不像在暗示通过以下提交消息Git的项目库:

docs:不提--quiet--exit-code在git-log中(1)

这些是diff-options,但它们实际上并没有意义log.

(1)diff-*代表瓷器git-diff所依据的管道命令.

  • `--exit-code` 在 `log` 的上下文中确实有意义,特别是在使用 `--grep` 时。 (2认同)