Skip to content

Commit

Permalink
Teach bash how to complete +refspec on git-push
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Jun 24, 2007
1 parent aeb5932 commit 161fea8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ _git_push ()
esac
__gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
;;
+*)
__gitcomp "$(__git_refs)" + "${cur#+}"
;;
*)
__gitcomp "$(__git_refs)"
;;
Expand Down

0 comments on commit 161fea8

Please sign in to comment.