git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] advice: add diverging advice for novices

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Mar 8, 2023, 02:48 UTC
Message-ID
<20230308024834.1562386-2-felipe.contreras@gmail.com>
In-Reply-To
<20230308024834.1562386-1-felipe.contreras@gmail.com>

The user might not necessarily know why ff only was configured, maybe an admin did it, or the installer (Git for Windows), or perhaps they just followed some online advice.

This can happen not only on pull.ff=only, but merge.ff=only too.

Even worse if the user has configured pull.rebase=false and merge.ff=only, because in those cases a diverging merge will constantly keep failing. There's no trivial way to get out of this other than `git merge --no-ff`.

Let's not assume our users are experts in git who completely understand all their configurations.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 advice.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/advice.c b/advice.c
index fd18968943..c3fb631f93 100644
--- a/advice.c
+++ b/advice.c
@@ -217,6 +217,13 @@ void NORETURN die_conclude_merge(void)
 
 void NORETURN die_ff_impossible(void)
 {
+	advise(_("Diverging branches can't be fast-forwarded, you need to either:\n"
+		"\n"
+		"\tgit merge --no-ff\n"
+		"\n"
+		"or:\n"
+		"\n"
+		"\tgit rebase\n"));
 	die(_("Not possible to fast-forward, aborting."));
 }
 
-- 
2.39.2
Previous: Felipe ContrerasNext: Junio C Hamano
Message 2 of 7 in “advice: add diverging advice”
  1. 0/2 advice: add diverging adviceFelipe Contreras, Mar 8, 2023
  2. 1/2 advice: add diverging advice for novicesFelipe Contreras, Mar 8, 2023
  3. Junio C HamanoMar 8, 2023
  4. 2/2 advice: make diverging advice configurableFelipe Contreras, Mar 8, 2023
  5. Taylor BlauMar 8, 2023
  6. Junio C HamanoMar 8, 2023
  7. Junio C HamanoMar 9, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.