Skip to content

Commit 161fea8

Browse files
committed
Teach bash how to complete +refspec on git-push
Using `git push origin +foo` to forcefully overwrite the remote branch named foo is a common idiom, especially since + is shorter than the long option --force and can be specified on a per-branch basis. We now complete `git push origin +foo` just like we do the standard `git push origin foo`. The leading + on a branch refspec does not alter the completion. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent aeb5932 commit 161fea8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,9 @@ _git_push ()
682682
esac
683683
__gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
684684
;;
685+
+*)
686+
__gitcomp "$(__git_refs)" + "${cur#+}"
687+
;;
685688
*)
686689
__gitcomp "$(__git_refs)"
687690
;;

0 commit comments

Comments
 (0)