From d62a34d0f71c96a4e6939dfe6a221082df832499 Mon Sep 17 00:00:00 2001 From: Wenxuan Zhang Date: Wed, 11 Mar 2026 00:44:12 +0800 Subject: [PATCH] fix: use git-switch native completion for switch_branch Use _git_switch/_git-switch instead of _git_checkout_branch/_git-branches to stay closer to git's own completion suggestions. --- completions/_git-forgit | 4 ++-- completions/git-forgit.bash | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/completions/_git-forgit b/completions/_git-forgit index d4d70dc..226abb6 100644 --- a/completions/_git-forgit +++ b/completions/_git-forgit @@ -120,7 +120,7 @@ _git-forgit() { stash_show) _git-stash-show ;; stash_push) _git-add ;; show) _git-show ;; - switch_branch) _git-branches ;; + switch_branch) _git-switch ;; worktree) _git-worktree ;; worktree_delete) _git-worktrees ;; esac @@ -134,7 +134,7 @@ _git-forgit() { compdef _git-add forgit::add compdef _git-branches forgit::branch::delete compdef _git-branches forgit::checkout::branch -compdef _git-branches forgit::switch::branch +compdef _git-switch forgit::switch::branch compdef __git_recent_commits forgit::checkout::commit compdef _git-checkout-file forgit::checkout::file compdef __git_tags forgit::checkout::tag diff --git a/completions/git-forgit.bash b/completions/git-forgit.bash index 357c1d9..3270758 100755 --- a/completions/git-forgit.bash +++ b/completions/git-forgit.bash @@ -125,7 +125,7 @@ _git_forgit() squash) _git_log ;; stash_show) _git_stash_show ;; stash_push) _git_add ;; - switch_branch) _git_checkout_branch ;; + switch_branch) _git_switch ;; worktree) _git_worktree ;; worktree_delete) _git_worktrees ;; esac @@ -148,7 +148,7 @@ then __git_complete forgit::add _git_add __git_complete forgit::branch::delete _git_branch_delete __git_complete forgit::checkout::branch _git_checkout_branch - __git_complete forgit::switch::branch _git_checkout_branch + __git_complete forgit::switch::branch _git_switch __git_complete forgit::checkout::commit _git_checkout __git_complete forgit::checkout::file _git_checkout_file __git_complete forgit::checkout::tag _git_checkout_tag @@ -175,7 +175,7 @@ then __git_complete "${forgit_add}" _git_add __git_complete "${forgit_branch_delete}" _git_branch_delete __git_complete "${forgit_checkout_branch}" _git_checkout_branch - __git_complete "${forgit_switch_branch}" _git_checkout_branch + __git_complete "${forgit_switch_branch}" _git_switch __git_complete "${forgit_checkout_commit}" _git_checkout __git_complete "${forgit_checkout_file}" _git_checkout_file __git_complete "${forgit_checkout_tag}" _git_checkout_tag