Created
April 28, 2009 13:32
-
-
Save joshuaclayton/103151 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.git-completion.sh | |
source ~/.bash_colors.sh | |
git_prompt_info() { | |
git_branch_prompt=$(__git_ps1 " | %s") | |
if [ -n "$git_branch_prompt" ]; then | |
if [ "changed" = $(git_status) ]; then | |
branch_prompt=$(__git_ps1 "${ESC}[${BRIGHT};${FG_RED}m %s") | |
elif [ "pending" = $(git_status) ]; then | |
branch_prompt=$(__git_ps1 "${ESC}[${BRIGHT};${FG_YELLOW}m %s") | |
elif [ "unchanged" = $(git_status) ]; then | |
branch_prompt=$(__git_ps1 "${ESC}[${BRIGHT};${FG_GREEN}m %s") | |
elif [ "untracked" = $(git_status) ]; then | |
branch_prompt=$(__git_ps1 "${ESC}[${BRIGHT};${FG_CYAN}m %s") | |
fi | |
# branch_prompt=$(__git_ps1 "%s") | |
echo $branch_prompt | |
fi | |
} | |
git_status() { | |
if [ -n "$(git status | grep 'Changed but not updated' 2> /dev/null)" ]; then | |
echo "changed" | |
elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then | |
echo "pending" | |
elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then | |
echo "untracked" | |
else | |
echo "unchanged" | |
fi | |
} | |
export PS1="${BRIGHT_BLACK}[ ${WHITE}\u ${BRIGHT_WHITE}\w\$(git_prompt_info) ${BRIGHT_BLACK}]${NORMAL}\$ ${RESET}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment