@matheusbsbs / matheus-bagliano / commits / 161fea832a
Fork 0

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 <spearce@spearce.org>

Shawn O. Pearce committed Jun 24, 2007 at 19:42 UTC 161fea832a8e8ea7d6cdc1bdc388f19825641a53
1 file changed +3
contrib/completion/git-completion.bash
+3
@@ -682,6 +682,9 @@ _git_push ()
682 esac
683 __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
684 ;;
685 + +*)
686 + __gitcomp "$(__git_refs)" + "${cur#+}"
687 + ;;
688 *)
689 __gitcomp "$(__git_refs)"
690 ;;