diff --git a/lib/git.zsh b/lib/git.zsh index 58d826d0c..52c7969f3 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/} +}