diff --git a/.bashrc b/.bashrc index 7e792c5..adfd6ab 100644 --- a/.bashrc +++ b/.bashrc @@ -52,9 +52,9 @@ __prompt_git_status() { fi } - # Add the branch if there have been commits. - if [[ -e "${GIT_REPO_INFO[1]}/refs/heads/master" ]]; then - BRANCH="$(git describe --contains --all HEAD)" + # 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 GIT_PROMPT+="!NO COMMITS!"