Thread (19 messages) 19 messages, 4 authors, 17d ago

Re: [PATCH] advice: use global config for default branch name

From: Ben Knoble <hidden>
Date: 2026-09-08 13:35:23

Le 7 sept. 2026 à 09:02, Vsevolod Myalitsin [off-list ref] a écrit :

The advice for configuring the default branch name
suggests disabling it with "git config set
advice.defaultBranchName false". This setting is
useless because it neither affects the current
repository nor newly created repositories.
Makes sense.
Suggest using "git config --global" instead.
I think we should probably say “git config set --global …”
using the modern forms, no?
quoted hunk ↗ jump to hunk
Signed-off-by: Vsevolod Myalitsin <redacted>
---
advice.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/advice.c b/advice.c
index 63bf8b0c5f..64ca4613b4 100644
--- a/advice.c
+++ b/advice.c
@@ -96,7 +96,7 @@ static struct {
static const char turn_off_instructions[] =
N_("\n"
-   "Disable this message with \"git config set advice.%s false\"");
+   "Disable this message with \"git config %s advice.%s false\"");

static void vadvise(const char *advice, int display_instructions,
           const char *key, va_list params)
@@ -107,7 +107,8 @@ static void vadvise(const char *advice, int display_instructions,
   strbuf_vaddf(&buf, advice, params);

   if (display_instructions)
-        strbuf_addf(&buf, turn_off_instructions, key);
+        strbuf_addf(&buf, turn_off_instructions,
+            strcmp(key, "defaultBranchName") ? "set" : "--global", key);
This would be hard to extend later for other advice options that also make more sense at the global level. Perhaps extract a little helper is_global(key)?

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help