What does git log --exit-code mean?

2 answers

TL DR

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

--exit-code is diff-* 1, which forces the Git diff-* to 1 if there are changes, and 0 otherwise.

[...] but I can’t find him anywhere.

You can read about it on the git-diff manual page (this is only mentioned in passing on the git-log manual page).

More details

Both --check and --exit-code described on the --exit-code git-diff page (more specifically, in 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. 

and

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

Some, but not all, diff-* compatible with git-log . The --check option is there, and the --exit-code option is not, as suggested by the following commit message from the Git-project repository :

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

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

(1) diff-* refers to the plumbing team on which porcelain git-diff .

+5
source

It is mentioned in git-diff docs (and, apparently, is not intended for use with git-log ):

"Make the program exit with codes like diff (1). That is, it exits from 1 if there are differences, and 0 means no differences."

+2
source

All Articles