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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tao Klerks <tao@xxxxxxxxxx>

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@xxxxxxxxxx>
---
    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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux