diff options
author | Robby Russell <robby@planetargon.com> | 2009-11-25 12:45:16 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2009-11-25 12:45:16 -0800 |
commit | 473dd3b2121ae0e54803098a7fde4b4c1e673145 (patch) | |
tree | 976fddae8fb6a8995782fed245e73ba94c6ae0cf /lib/git.zsh | |
parent | b549dd49991b87e16aa3c7225d47e435969d46fe (diff) | |
download | zsh-473dd3b2121ae0e54803098a7fde4b4c1e673145.tar.gz zsh-473dd3b2121ae0e54803098a7fde4b4c1e673145.tar.bz2 zsh-473dd3b2121ae0e54803098a7fde4b4c1e673145.zip |
Adding current_branch function, which can be used like: git pull origin master
Diffstat (limited to 'lib/git.zsh')
-rw-r--r-- | lib/git.zsh | 8 |
1 files changed, 8 insertions, 0 deletions
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/} +} |