diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2014-08-14 01:15:55 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2014-08-14 01:18:34 +0200 |
commit | 122a4ba97ea8b6098eb8b569d6586283f42cffe4 (patch) | |
tree | ae7c991f75166dc36eec9966970b3aae2e65be21 | |
parent | a7b75428089c54b6544be51699de41789a56c47c (diff) | |
download | dotfiles-122a4ba97ea8b6098eb8b569d6586283f42cffe4.tar.xz |
zshrc: get_git_branch: Check HEAD file directly
This fixes errors from git when in a repo without any commits.
Stolen (again) from Earnestly/dotfiles@a855e6bf
Original-work-by: Earnestly <zibeon@gmail.com>
-rw-r--r-- | zsh/.zshrc | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -60,7 +60,8 @@ $(yellow "└─╼") " function get_git_branch { if [[ -d .git ]]; then - branch="$(git rev-parse --abbrev-ref HEAD) " + branch="$(< .git/HEAD)" + branch="${branch##*/} " else branch="" fi |