summaryrefslogtreecommitdiff
path: root/plugins/git-remote-branch
diff options
context:
space:
mode:
authorPeter Tillemans <pti@snamellit.com>2013-01-02 09:42:14 +0100
committerPeter Tillemans <pti@snamellit.com>2013-01-02 09:42:14 +0100
commit587832f15579398e54690e62ea588178e951f8f8 (patch)
tree1e2149e743710e2c72a567a042606333bbad88da /plugins/git-remote-branch
parent55cc936d4e6d88f18518cedc9574b1df10702f8b (diff)
parent80a603259657acab97badbae20003b5a34c901f9 (diff)
downloadzsh-587832f15579398e54690e62ea588178e951f8f8.tar.gz
zsh-587832f15579398e54690e62ea588178e951f8f8.tar.bz2
zsh-587832f15579398e54690e62ea588178e951f8f8.zip
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/git-remote-branch')
-rw-r--r--plugins/git-remote-branch/git-remote-branch.plugin.zsh18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
new file mode 100644
index 000000000..ff98cbf87
--- /dev/null
+++ b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
@@ -0,0 +1,18 @@
+_git_remote_branch() {
+ ref=$(git symbolic-ref HEAD 2> /dev/null)
+ if [[ -n $ref ]]; then
+ if (( CURRENT == 2 )); then
+ # first arg: operation
+ compadd create publish rename delete track
+ elif (( CURRENT == 3 )); then
+ # second arg: remote branch name
+ compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
+ elif (( CURRENT == 4 )); then
+ # third arg: remote name
+ compadd `git remote`
+ fi
+ else;
+ _files
+ fi
+}
+compdef _git_remote_branch grb