Skip to content

Commit fb2b981

Browse files
advice: recommend GIT_ADVICE=0 for tools
The GIT_ADVICE environment variable was added implicitly in b79deeb (advice: add --no-advice global option, 2024-05-03) but was not documented. Add documentation to show that it is an option for tools that want to disable these messages. Make note that while the --no-advice option exists, older Git versions will fail to parse that option. The environment variable presents a way to change the behavior of Git versions that understand it without disrupting older versions. Co-authored-by: Junio C Hamano <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2e7b89e commit fb2b981

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Documentation/config/advice.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ advice.*::
22
These variables control various optional help messages designed to
33
aid new users. When left unconfigured, Git will give the message
44
alongside instructions on how to squelch it. You can tell Git
5-
that you do not need the help message by setting these to `false`:
5+
that you have understood the issue and no longer need a specific
6+
help message by setting the corresponding variable to `false`.
7+
+
8+
As they are intended to help human users, these messages are output to
9+
the standard error. When tools that run Git as a subprocess find them
10+
disruptive, they can set `GIT_ADVICE=0` in the environment to squelch
11+
all advice messages.
612
+
713
--
814
addEmbeddedRepo::

Documentation/git.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,17 @@ standard output.
10271027
adequate and support for it is likely to be removed in the
10281028
foreseeable future (along with the variable).
10291029

1030+
`GIT_ADVICE`::
1031+
If set to `0`, then disable all advice messages. These messages are
1032+
intended to provide hints to human users that may help them get out of
1033+
problematic situations or take advantage of new features. Users can
1034+
disable individual messages using the `advice.*` config keys. These
1035+
messages may be disruptive to tools that execute Git processes, so this
1036+
variable is available to disable the messages. (The `--no-advice`
1037+
global option is also available, but old Git versions may fail when
1038+
this option is not understood. The environment variable will be ignored
1039+
by Git versions that do not understand it.)
1040+
10301041
Discussion[[Discussion]]
10311042
------------------------
10321043

0 commit comments

Comments
 (0)