diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 58d18d41a23f2d33b096c6cd16c1ab11adfab269..656e49710e59fea8378c5f93eff2da072231eae6 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2183,6 +2183,10 @@ _git_switch () fi if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then only_local_ref=y + else + # --guess --detach is invalid combination, no + # dwim will be done when --detach is specified + track_opt= fi if [ $only_local_ref = y -a -z "$track_opt" ]; then __gitcomp_direct "$(__git_heads "" "$cur" " ")"