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

[PATCH] pull: conflict hint pull.rebase suggestion should offer "merges" vs "true"

From
Tao Klerks via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 5, 2023, 16:24 UTC
Message-ID
<pull.1474.git.1675614276549.gitgitgadget@gmail.com>
From: Tao Klerks <tao@klerks.biz>

When "git pull" is called without a conflict-handling instruction or configuration, it displays a hint proposing "pull.rebase" and "pull.ff" config options for future handling.

The hint offers three permanent settings, "merge", rebase", and "ff". The proposed command for "rebase" is "git config pull.rebase true".

Unfortunately, this rebase configuration can easily lead to non-expert users accidentally rebasing not their own commits, instead others' commits, if the new commits they have locally before the "pull" include a merge of another branch, eg "main".

Since 2018 in git version "2.18", it has supported a new rebase flag "--rebase-merges", with corresponding pull.rebase config option "merges". This new option is ideal for rebasing local work on "pull", as it will not "mangle"/flatten any local merge commits but rather recreate them.

Change the pull conflict hint text to propose "pull.rebase merges" instead of "pull.rebase true", and "git pull --rebase=merges" instead of "git pull --rebase".

Signed-off-by: Tao Klerks <tao@klerks.biz>
---
    pull: conflict hint pull.rebase suggestion should offer "merges" vs
    "true"
    
    Hint change as proposed in
    https://lore.kernel.org/git/xmqqa61uo3q0.fsf@gitster.g/
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1474%2FTaoK%2Ftao-fetch-rebase-hint-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1474/TaoK/tao-fetch-rebase-hint-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1474
 builtin/pull.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/pull.c b/builtin/pull.c
index 1ab4de0005d..535364fbb07 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -967,13 +967,13 @@ static void show_advice_pull_non_ff(void)
 		 "your next pull:\n"
 		 "\n"
 		 "  git config pull.rebase false  # merge\n"
-		 "  git config pull.rebase true   # rebase\n"
+		 "  git config pull.rebase merges # rebase\n"
 		 "  git config pull.ff only       # fast-forward only\n"
 		 "\n"
 		 "You can replace \"git config\" with \"git config --global\" to set a default\n"
-		 "preference for all repositories. You can also pass --rebase, --no-rebase,\n"
-		 "or --ff-only on the command line to override the configured default per\n"
-		 "invocation.\n"));
+		 "preference for all repositories. You can also pass --rebase=merges,\n"
+		 "--no-rebase, or --ff-only on the command line to override the configured\n"
+		 "default per invocation.\n"));
 }
 
 int cmd_pull(int argc, const char **argv, const char *prefix)

base-commit: a6a323b31e2bcbac2518bddec71ea7ad558870eb
-- 
gitgitgadget
Next: Alex Henrie
Message 1 of 34 in “pull: conflict hint pull.rebase suggestion should offer "merges" vs "true"”
  1. pull: conflict hint pull.rebase suggestion should offer "merges" vs "true"Tao Klerks via GitGitGadget, Feb 5, 2023
  2. Alex HenrieFeb 16, 2023
  3. Tao KlerksFeb 16, 2023
  4. Alex HenrieFeb 17, 2023
  5. Tao KlerksFeb 17, 2023
  6. Alex HenrieFeb 17, 2023
  7. Junio C HamanoFeb 17, 2023
  8. Elijah NewrenFeb 18, 2023
  9. Phillip WoodFeb 18, 2023
  10. Tao KlerksFeb 20, 2023
  11. Phillip WoodFeb 20, 2023
  12. Elijah NewrenFeb 20, 2023
  13. Tao KlerksFeb 21, 2023
  14. Sergey OrganovFeb 22, 2023
  15. Elijah NewrenFeb 24, 2023
  16. Sergey OrganovFeb 24, 2023
  17. Elijah NewrenFeb 24, 2023
  18. Sergey OrganovFeb 25, 2023
  19. Elijah NewrenFeb 25, 2023
  20. Sergey OrganovFeb 26, 2023
  21. Elijah NewrenFeb 27, 2023
  22. Sergey OrganovFeb 27, 2023
  23. Elijah NewrenFeb 28, 2023
  24. Elijah NewrenFeb 20, 2023
  25. Tao KlerksFeb 20, 2023
  26. Elijah NewrenFeb 20, 2023
  27. Alex HenrieFeb 20, 2023
  28. Tao KlerksFeb 21, 2023
  29. Alex HenrieFeb 21, 2023
  30. Tao KlerksFeb 21, 2023
  31. Elijah NewrenFeb 24, 2023
  32. Felipe ContrerasFeb 28, 2023
  33. Alex HenrieFeb 28, 2023
  34. Felipe ContrerasMar 1, 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.