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

标签 git command-line-interface

git-log man page--check 选项描述为与 --exit-code 选项不兼容。我想知道这个 --exit-code 是什么意思,但我无法在任何地方找到它。我试过 man git logman git、Google 和直接搜索 SO... 无济于事!

--exit-codegit log 意味着什么?

最佳答案

TL;博士

I'd like to know what this --exit-code means [...]

--exit-code 是一个 diff-*1 选项,它使 Git 命令以 1 退出> 如果有变化,则 0 否则。

[...] but I can't find it anywhere.

您可以在 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.

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

一些(虽然不是全部)diff-* 选项与 git-log 兼容。 --check 选项是,而 --exit-code 选项不是,正如 commit message 中的以下 Git-project repository 所暗示的:

docs: don't mention --quiet or --exit-code in git-log(1)

These are diff-options, but they don't actually make sense in the context of log.

(1) diff-* 代表 porcelain git-diff 所基于的管道命令。

关于git - git log --exit-code 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32853972/

相关文章:

git - 将 Github 存储库克隆到特定的 Windows 文件夹?

git - 为什么我无法推送新克隆的存储库?

java - 如何使用控制台启动器从命令行运行 JUnit5 测试?

linux - 路径名星号扩展和制作新文件

Javac "cannot find symbol"

git - 一个 git 存储库可以跟踪 subversion 和 git remotes 吗?

git - Composer - 在没有 composer.json 的情况下添加 git 存储库

macos - 尝试在 OSX : cannont exec 'git-credential-osxkeychain' : Permission denied` 上安装 git

.net - 语句 "#pragma managed(push, off)"和 "#pragma managed(pop)"是什么意思?

Elasticsearch 密码重置失败并显示 https