diff --git a/.bashrc b/.bashrc index 4628619..c1febf8 100644 --- a/.bashrc +++ b/.bashrc @@ -55,11 +55,12 @@ __prompt_git_status() { } # Add the branch or a no commits marker. - BRANCH="$(git describe --contains --all HEAD 2>/dev/null)" - if [[ -n "$BRANCH" ]]; then - GIT_PROMPT+="$BRANCH" - else + BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" + if [[ "$BRANCH" == "HEAD" ]]; then GIT_PROMPT+="!NO COMMITS!" + unset BRANCH + else + GIT_PROMPT+="$BRANCH" fi # Add upstream status.