Skip to content

Commit 92d7c8e

Browse files
committed
Avoid src:dst syntax as default bash completion for git push
Raimund Bauer just discovered that the default bash completion for a local branch name in a git-push line is not the best choice when the branch does not exist on the remote system. In the past we have always completed the local name 'test' as "test:test", indicating that the destination name is the same as the local name. But this fails when "test" does not yet exist on the remote system, as there is no "test" branch for it to match the name against. Fortunately git-push does the right thing when given just the local branch, as it assumes you want to use the same name in the destination repository. So we now offer "test" as the completion in a git-push line, and let git-push assume that is also the remote branch name. We also still support the remote branch completion after the :, but only if the user manually adds the colon before trying to get a completion. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 45fd8bd commit 92d7c8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ _git_push ()
683683
__gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
684684
;;
685685
*)
686-
__gitcomp "$(__git_refs2)"
686+
__gitcomp "$(__git_refs)"
687687
;;
688688
esac
689689
;;

0 commit comments

Comments
 (0)