mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
completions/git: Allow switch to complete remote branches
While it is true that `git switch <remote-branch>` errors to disallow a detached head without the `-d` option, it is valid to use any starting point (commit or reference) in conjunction with the `-c` option. Additionally, the starting point can occur before any option. This enables the following completions: * `git switch -c <local-name> <any-branch>` * `git switch <any-branch> -c <local-name>` * `git switch -d <any-starting-point>` * `git switch <any-branch> -d` The trade-off is this does allow for `git switch <remote-branch>` to be completed with an error. Note that this logically reverts7e3d3cc30f
. (cherry picked from commitfdd4bcf718
)
This commit is contained in:
parent
480e9809f2
commit
43c87e13c9
1 changed files with 1 additions and 1 deletions
|
@ -1958,7 +1958,7 @@ complete -F -c git -n '__fish_git_using_command restore' -n '__fish_git_contains
|
|||
# switch options
|
||||
complete -f -c git -n __fish_git_needs_command -a switch -d 'Switch to a branch'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_local_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s c -l create -d 'Create a new branch'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s C -l force-create -d 'Force create a new branch'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -d 'Switch to a commit for inspection and discardable experiment' -rka '(__fish_git_refs)'
|
||||
|
|
Loading…
Reference in a new issue