From 64f1f58fe7c0837bd0ae56ba83add5e1b84c54d3 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Wed, 7 Oct 2020 22:48:15 -0700 Subject: checkout: learn to respect checkout.guess The current behavior of git checkout/switch is that --guess is currently enabled by default. However, some users may not wish for this to happen automatically. Instead of forcing users to specify --no-guess manually each time, teach these commands the checkout.guess configuration variable that gives users the option to set a default behavior. Teach the completion script to recognize the new config variable and disable DWIM logic if it is set to false. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- Documentation/config/checkout.txt | 5 +++++ Documentation/git-checkout.txt | 5 ++++- Documentation/git-switch.txt | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/config/checkout.txt b/Documentation/config/checkout.txt index e3684a5459..2cddf7b4b4 100644 --- a/Documentation/config/checkout.txt +++ b/Documentation/config/checkout.txt @@ -16,3 +16,8 @@ will checkout the `` branch on another remote, and by linkgit:git-worktree[1] when `git worktree add` refers to a remote branch. This setting might be used for other checkout-like commands or functionality in the future. + +checkout.guess:: + Provides the default value for the `--guess` or `--no-guess` + option in `git checkout` and `git switch`. See + linkgit:git-switch[1] and linkgit:git-checkout[1]. diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index afa5c11fd3..1435d3de9e 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -192,7 +192,10 @@ branches from there if `` is ambiguous but exists on the 'origin' remote. See also `checkout.defaultRemote` in linkgit:git-config[1]. + -Use `--no-guess` to disable this. +`--guess` is the default behavior. Use `--no-guess` to disable it. ++ +The default behavior can be set via the `checkout.guess` configuration +variable. -l:: Create the new branch's reflog; see linkgit:git-branch[1] for diff --git a/Documentation/git-switch.txt b/Documentation/git-switch.txt index 3759c3a265..5c438cd505 100644 --- a/Documentation/git-switch.txt +++ b/Documentation/git-switch.txt @@ -103,6 +103,9 @@ ambiguous but exists on the 'origin' remote. See also `checkout.defaultRemote` in linkgit:git-config[1]. + `--guess` is the default behavior. Use `--no-guess` to disable it. ++ +The default behavior can be set via the `checkout.guess` configuration +variable. -f:: --force:: -- cgit v1.2.3