浏览代码

Adding current_branch function, which can be used like: git pull origin master

Robby Russell 15 年之前
父节点
当前提交
473dd3b212
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      lib/git.zsh

+ 8 - 0
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/}
+}