diff --git a/zshrc.org b/zshrc.org index 08b9dff..aa9cc76 100644 --- a/zshrc.org +++ b/zshrc.org @@ -439,7 +439,10 @@ This needs to be diff'd among the versions } 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