summaryrefslogtreecommitdiff
path: root/01_Functions.zsh
diff options
context:
space:
mode:
Diffstat (limited to '01_Functions.zsh')
-rw-r--r--01_Functions.zsh5
1 files changed, 4 insertions, 1 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index a4aa38a..f6b300a 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -39,7 +39,10 @@ preprint()
get_git_branch ()
{
- echo $(git branch 2>&- | grep -E '^\* ' | cut -c3-)
+ my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)"
+ [ $my_git_branch == "(no branch)" ] && my_git_branch="$(git-log HEAD~1..HEAD --pretty=format:%h)"
+
+ echo $my_git_branch
}
check_git_status ()