Use more efficient way to find current branch name

This might have drawbacks in case we are in "detached head" state
master
Jacopo De Simoi 2 years ago
parent 37f564018a
commit 033babcfbd
  1. 5
      zshrc.org

@ -439,7 +439,10 @@ This needs to be diff'd among the versions
} }
function git-current-branch () { function git-current-branch () {
git status -b | head -n 1 | awk {'print $3'} # do I want to give up on revision numbers in detached-head state?
git rev-parse --abbrev-ref HEAD | grep -v HEAD || \
git describe --exact-match HEAD 2> /dev/null || \
git rev-parse HEAD
} }
#+end_src #+end_src

Loading…
Cancel
Save