From 33f424134ea59711e3605887fc555130b6c6486d Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 25 Nov 2009 12:45:16 -0800 Subject: [PATCH] Adding current_branch function, which can be used like: git pull origin master --- lib/git.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 58d826d0..52c7969f 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -12,3 +12,11 @@ parse_git_dirty () { fi } +# +# Will return the current branch name +# Usage example: git pull origin $(current_branch) +# +function current_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo ${ref#refs/heads/} +}