From 8f4002a1e4d8381945b0fa0fec4a1b479acd93b4 Mon Sep 17 00:00:00 2001 From: Markus Kurtz Date: Tue, 2 Sep 2025 09:36:30 +0200 Subject: github #143: list only remote branches for `git checkout --guess` --- Completion/Unix/Command/_git | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index d6420e77a..fdf35b2f5 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -517,6 +517,10 @@ _git-checkout () { _alternative remote-branches::__git_remote_branch_names && ret=0 elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch|--no-guess]} ]]; then _alternative $tree_ish_arg $file_arg && ret=0 + elif [[ -n ${opt_args[(i)--guess]} ]]; then + # --guess is the default but if it has been explicitly specified, + # we'll only complete remote branches + __git_remote_branch_names_noprefix && ret=0 else _alternative \ $file_arg \ -- cgit v1.2.3-70-g09d2