# [PATCH] advice: recommend GIT_ADVICE=0 for tools

6 messages from 2024-09-05 to 2024-09-06. Participants: Derrick Stolee via GitGitGadget, Eric Sunshine, Junio C Hamano, Derrick Stolee.
Thread: https://gitlist.dev/t/62069

## Derrick Stolee via GitGitGadget, 2024-09-05 17:59

Subject: [PATCH] advice: recommend GIT_ADVICE=0 for tools
Message-ID: <pull.1781.git.1725559154387.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1781.git.1725559154387.gitgitgadget%40gmail.com

```
From: Derrick Stolee <stolee@gmail.com>

The GIT_ADVICE environment variable was added implicitly in b79deeb5544
(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.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
---
    advice: recommend GIT_ADVICE=0 for tools
    
    I'm finally getting around to this doc update that I promised [1] a few
    weeks ago.
    
    [1]
    https://lore.kernel.org/git/e90949ed-8065-4498-9ddb-3d5c6afa7b35@gmail.com/
    
    Thanks, -Stolee

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1781%2Fderrickstolee%2Fadvice-docs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1781/derrickstolee/advice-docs-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1781

 Documentation/config/advice.txt | 10 +++++++---
 Documentation/git.txt           | 11 +++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index 0ba89898207..c05f42c27c8 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -1,8 +1,12 @@
 advice.*::
 	These variables control various optional help messages designed to
-	aid new users.  When left unconfigured, Git will give the message
-	alongside instructions on how to squelch it.  You can tell Git
-	that you do not need the help message by setting these to `false`:
+	aid new users. These are output to `stderr` by default as they are
+	intended to help human readers. Tools that execute Git as a subprocess
+	can disable these messages by setting `GIT_ACVICE=0` in the environment.
++
+When left unconfigured, Git will give the message alongside instructions on how
+to squelch it.  You can tell Git that you do not need the help message by
+setting these to `false`:
 +
 --
 	addEmbeddedRepo::
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4489e2297a3..d15a8697625 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -1027,6 +1027,17 @@ standard output.
 	adequate and support for it is likely to be removed in the
 	foreseeable future (along with the variable).
 
+`GIT_ADVICE`::
+	If set to `0`, then disable all advice messages. These messages are
+	intended to provide hints to human users that may help them get out of
+	problematic situations or take advantage of new features. Users can
+	disable individual messages using the `advice.*` config keys. These
+	messages may be disruptive to tools that execute Git processes, so this
+	variable is available to disable the messages. (The `--no-advice`
+	global option is also available, but old Git versions may fail when
+	this option is not understood. The environment variable will be ignored
+	by Git versions that do not understand it.)
+
 Discussion[[Discussion]]
 ------------------------
 

base-commit: 2e7b89e038c0c888acf61f1b4ee5a43d4dd5e94c
-- 
gitgitgadget

```

## Eric Sunshine, 2024-09-05 18:02

Subject: Re: [PATCH] advice: recommend GIT_ADVICE=0 for tools
Message-ID: <CAPig+cSGry+QMpkkiJb8A94w1M+J_5beEKaT-xrGeL34xME4hA@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcSGry%2BQMpkkiJb8A94w1M%2BJ_5beEKaT-xrGeL34xME4hA%40mail.gmail.com
In-Reply-To: <pull.1781.git.1725559154387.gitgitgadget@gmail.com>

```
On Thu, Sep 5, 2024 at 1:59 PM Derrick Stolee via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> The GIT_ADVICE environment variable was added implicitly in b79deeb5544
> (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.
>
> Signed-off-by: Derrick Stolee <stolee@gmail.com>
> ---
> diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
> @@ -1,8 +1,12 @@
>  advice.*::
>         These variables control various optional help messages designed to
> -       aid new users.  When left unconfigured, Git will give the message
> -       alongside instructions on how to squelch it.  You can tell Git
> -       that you do not need the help message by setting these to `false`:
> +       aid new users. These are output to `stderr` by default as they are
> +       intended to help human readers. Tools that execute Git as a subprocess
> +       can disable these messages by setting `GIT_ACVICE=0` in the environment.

s/GIT_ACVICE/GIT_ADVICE/

```

## Junio C Hamano, 2024-09-05 20:26

Subject: Re: [PATCH] advice: recommend GIT_ADVICE=0 for tools
Message-ID: <xmqq4j6t26fs.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq4j6t26fs.fsf%40gitster.g
In-Reply-To: <pull.1781.git.1725559154387.gitgitgadget@gmail.com>

```
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  advice.*::
>  	These variables control various optional help messages designed to
> -	aid new users.  When left unconfigured, Git will give the message
> -	alongside instructions on how to squelch it.  You can tell Git
> -	that you do not need the help message by setting these to `false`:
> +	aid new users. These are output to `stderr` by default as they are
> +	intended to help human readers. Tools that execute Git as a subprocess
> +	can disable these messages by setting `GIT_ACVICE=0` in the environment.
> ++
> +When left unconfigured, Git will give the message alongside instructions on how
> +to squelch it.  You can tell Git that you do not need the help message by
> +setting these to `false`:

This somehow makes it sounds like it is an "aside, by the way" that
these trigger by default and that you can selectively disable it by
setting these variables, but shouldn't the stress be the other way
around?  Shouldn't the mention of GIT_ADVICE be a side note, leaving
primary text target human users?

Perhaps like this?

Thanks.

 Documentation/config/advice.txt |  8 +++++++-
 Documentation/git.txt           | 11 +++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git c/Documentation/config/advice.txt w/Documentation/config/advice.txt
index 0ba8989820..d749aee7f4 100644
--- c/Documentation/config/advice.txt
+++ w/Documentation/config/advice.txt
@@ -2,7 +2,13 @@ advice.*::
 	These variables control various optional help messages designed to
 	aid new users.  When left unconfigured, Git will give the message
 	alongside instructions on how to squelch it.  You can tell Git
-	that you do not need the help message by setting these to `false`:
+	that you have understood the issue and no longer need a specific
+	help message by setting the corresponding variable to `false`.
++
+As they are intended to help human users, these messages are output
+to the standard error.  When tools that run Git as a subprocesses
+find them disruptive, they can set `GIT_ADVICE=0` in the environment
+to squelch all advice messages.
 +
 --
 	addEmbeddedRepo::
diff --git c/Documentation/git.txt w/Documentation/git.txt
index 4489e2297a..d15a869762 100644
--- c/Documentation/git.txt
+++ w/Documentation/git.txt
@@ -1027,6 +1027,17 @@ standard output.
 	adequate and support for it is likely to be removed in the
 	foreseeable future (along with the variable).
 
+`GIT_ADVICE`::
+	If set to `0`, then disable all advice messages. These messages are
+	intended to provide hints to human users that may help them get out of
+	problematic situations or take advantage of new features. Users can
+	disable individual messages using the `advice.*` config keys. These
+	messages may be disruptive to tools that execute Git processes, so this
+	variable is available to disable the messages. (The `--no-advice`
+	global option is also available, but old Git versions may fail when
+	this option is not understood. The environment variable will be ignored
+	by Git versions that do not understand it.)
+
 Discussion[[Discussion]]
 ------------------------
 

```

## Derrick Stolee, 2024-09-06 19:47

Subject: Re: [PATCH] advice: recommend GIT_ADVICE=0 for tools
Message-ID: <a60b6cda-6f55-4133-9b26-5475e20cc839@gmail.com>
URL: https://gitlist.dev/e/a60b6cda-6f55-4133-9b26-5475e20cc839%40gmail.com
In-Reply-To: <CAPig+cSGry+QMpkkiJb8A94w1M+J_5beEKaT-xrGeL34xME4hA@mail.gmail.com>

```
On 9/5/24 2:02 PM, Eric Sunshine wrote:
> On Thu, Sep 5, 2024 at 1:59 PM Derrick Stolee via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>> The GIT_ADVICE environment variable was added implicitly in b79deeb5544
>> (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.
>>
>> Signed-off-by: Derrick Stolee <stolee@gmail.com>
>> ---
>> diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
>> @@ -1,8 +1,12 @@
>>   advice.*::
>>          These variables control various optional help messages designed to
>> -       aid new users.  When left unconfigured, Git will give the message
>> -       alongside instructions on how to squelch it.  You can tell Git
>> -       that you do not need the help message by setting these to `false`:
>> +       aid new users. These are output to `stderr` by default as they are
>> +       intended to help human readers. Tools that execute Git as a subprocess
>> +       can disable these messages by setting `GIT_ACVICE=0` in the environment.
> 
> s/GIT_ACVICE/GIT_ADVICE/

Thank you for catching my typo!
-Stolee


```

## Derrick Stolee, 2024-09-06 19:49

Subject: Re: [PATCH] advice: recommend GIT_ADVICE=0 for tools
Message-ID: <da98da07-b2f4-4608-9038-7ce4b8e2d74b@gmail.com>
URL: https://gitlist.dev/e/da98da07-b2f4-4608-9038-7ce4b8e2d74b%40gmail.com
In-Reply-To: <xmqq4j6t26fs.fsf@gitster.g>

```
On 9/5/24 4:26 PM, Junio C Hamano wrote:

> This somehow makes it sounds like it is an "aside, by the way" that
> these trigger by default and that you can selectively disable it by
> setting these variables, but shouldn't the stress be the other way
> around?  Shouldn't the mention of GIT_ADVICE be a side note, leaving
> primary text target human users?
> 
> Perhaps like this?
> 
> Thanks.
> 
>   Documentation/config/advice.txt |  8 +++++++-
>   Documentation/git.txt           | 11 +++++++++++
>   2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git c/Documentation/config/advice.txt w/Documentation/config/advice.txt
> index 0ba8989820..d749aee7f4 100644
> --- c/Documentation/config/advice.txt
> +++ w/Documentation/config/advice.txt
> @@ -2,7 +2,13 @@ advice.*::
>   	These variables control various optional help messages designed to
>   	aid new users.  When left unconfigured, Git will give the message
>   	alongside instructions on how to squelch it.  You can tell Git
> -	that you do not need the help message by setting these to `false`:
> +	that you have understood the issue and no longer need a specific
> +	help message by setting the corresponding variable to `false`.
> ++
> +As they are intended to help human users, these messages are output
> +to the standard error.  When tools that run Git as a subprocesses
> +find them disruptive, they can set `GIT_ADVICE=0` in the environment
> +to squelch all advice messages.
I like this a lot better. Your careful edit is substantial enough
that I will give you co-authored-by in v2.

Thanks,
-Stolee


```

## Derrick Stolee via GitGitGadget, 2024-09-06 20:22

Subject: [PATCH v2] advice: recommend GIT_ADVICE=0 for tools
Message-ID: <pull.1781.v2.git.1725654155162.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1781.v2.git.1725654155162.gitgitgadget%40gmail.com
In-Reply-To: <pull.1781.git.1725559154387.gitgitgadget@gmail.com>

```
From: Derrick Stolee <stolee@gmail.com>

The GIT_ADVICE environment variable was added implicitly in b79deeb5544
(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 <gitster@pobox.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
---
    advice: recommend GIT_ADVICE=0 for tools
    
    I'm finally getting around to this doc update that I promised [1] a few
    weeks ago.
    
    [1]
    https://lore.kernel.org/git/e90949ed-8065-4498-9ddb-3d5c6afa7b35@gmail.com/
    
    Thanks, -Stolee

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1781%2Fderrickstolee%2Fadvice-docs-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1781/derrickstolee/advice-docs-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1781

Range-diff vs v1:

 1:  52f6450bbf8 ! 1:  aacc8c06017 advice: recommend GIT_ADVICE=0 for tools
     @@ Commit message
          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 <gitster@pobox.com>
          Signed-off-by: Derrick Stolee <stolee@gmail.com>
      
       ## Documentation/config/advice.txt ##
     -@@
     - advice.*::
     +@@ Documentation/config/advice.txt: advice.*::
       	These variables control various optional help messages designed to
     --	aid new users.  When left unconfigured, Git will give the message
     --	alongside instructions on how to squelch it.  You can tell Git
     + 	aid new users.  When left unconfigured, Git will give the message
     + 	alongside instructions on how to squelch it.  You can tell Git
      -	that you do not need the help message by setting these to `false`:
     -+	aid new users. These are output to `stderr` by default as they are
     -+	intended to help human readers. Tools that execute Git as a subprocess
     -+	can disable these messages by setting `GIT_ACVICE=0` in the environment.
     ++	that you have understood the issue and no longer need a specific
     ++	help message by setting the corresponding variable to `false`.
      ++
     -+When left unconfigured, Git will give the message alongside instructions on how
     -+to squelch it.  You can tell Git that you do not need the help message by
     -+setting these to `false`:
     ++As they are intended to help human users, these messages are output to
     ++the standard error. When tools that run Git as a subprocess find them
     ++disruptive, they can set `GIT_ADVICE=0` in the environment to squelch
     ++all advice messages.
       +
       --
       	addEmbeddedRepo::


 Documentation/config/advice.txt |  8 +++++++-
 Documentation/git.txt           | 11 +++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index 0ba89898207..257db589181 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -2,7 +2,13 @@ advice.*::
 	These variables control various optional help messages designed to
 	aid new users.  When left unconfigured, Git will give the message
 	alongside instructions on how to squelch it.  You can tell Git
-	that you do not need the help message by setting these to `false`:
+	that you have understood the issue and no longer need a specific
+	help message by setting the corresponding variable to `false`.
++
+As they are intended to help human users, these messages are output to
+the standard error. When tools that run Git as a subprocess find them
+disruptive, they can set `GIT_ADVICE=0` in the environment to squelch
+all advice messages.
 +
 --
 	addEmbeddedRepo::
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4489e2297a3..d15a8697625 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -1027,6 +1027,17 @@ standard output.
 	adequate and support for it is likely to be removed in the
 	foreseeable future (along with the variable).
 
+`GIT_ADVICE`::
+	If set to `0`, then disable all advice messages. These messages are
+	intended to provide hints to human users that may help them get out of
+	problematic situations or take advantage of new features. Users can
+	disable individual messages using the `advice.*` config keys. These
+	messages may be disruptive to tools that execute Git processes, so this
+	variable is available to disable the messages. (The `--no-advice`
+	global option is also available, but old Git versions may fail when
+	this option is not understood. The environment variable will be ignored
+	by Git versions that do not understand it.)
+
 Discussion[[Discussion]]
 ------------------------
 

base-commit: 2e7b89e038c0c888acf61f1b4ee5a43d4dd5e94c
-- 
gitgitgadget

```
