Skip to content

Instantly share code, notes, and snippets.

@TheNaoX
Created June 1, 2015 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheNaoX/e3cf7654bc7cfbb660b4 to your computer and use it in GitHub Desktop.
Save TheNaoX/e3cf7654bc7cfbb660b4 to your computer and use it in GitHub Desktop.
function parse_git_dirty {
git diff --quiet HEAD &>/dev/null
[[ $? == 1 ]] && echo "…"
}
if [ -n __git_ps1 ]; then
function parse_git_branch {
local branch=$(__git_ps1 "%s")
[[ $branch ]] && echo " $branch$(parse_git_dirty)"
}
fi
DIRECTORY_COLOR="\[\033[1;33m\]"
USER_COLOR="\[\033[1;36m\]"
BRANCH_COLOR="\[\033[1;31m\]"
BLACK="\[\033[0;1m\]"
export PS1="$USER_COLOR\u :: $DIRECTORY_COLOR\W$BRANCH_COLOR\$(parse_git_branch) $DIRECTORY_COLOR$ $BLACK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment