From 7e3d3cc30f61d466f450a61ebee7c7fcd264967f Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 12 Dec 2020 09:49:19 +0900 Subject: [PATCH] completions: git switch only takes branch names Trying to switch to a remote branch like "upstream/ver2" will error with "fatal: a branch is expected, got remote branch 'upstream/ver2'", so these completions should only print the branch name. There doesn't seem to be a function for printing just the branch names for remotes (branch names can have forward-slashes in them), so I have just left them out for now. --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index a0097b0e6..d83f1b90c 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -1571,7 +1571,7 @@ complete -f -c git -n '__fish_git_using_command restore; and contains -- --stage complete -f -c git -n '__fish_git_using_command restore; and __fish_contains_opt -s s source' -a '(git ls-files)' # switch options complete -f -c git -n __fish_git_needs_command -a switch -d 'Switch to a branch' -complete -k -f -c git -n '__fish_git_using_command switch' -a '(__fish_git_branches)' +complete -k -f -c git -n '__fish_git_using_command switch' -a '(__fish_git_local_branches)' complete -k -f -c git -n '__fish_git_using_command switch' -a '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch' complete -f -c git -n '__fish_git_using_command switch' -r -s c -l create -d 'Create a new branch' complete -f -c git -n '__fish_git_using_command switch' -r -s C -l force-create -d 'Force create a new branch'