Created
September 21, 2011 18:52
-
-
Save jxson/1232968 to your computer and use it in GitHub Desktop.
Git info in your `bash` prompt like ~/Code/haiku (trusting) ☠
This file contains 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
export COLOR_NONE='\[\e[0m\]' # No Color | |
export COLOR_LIGHT_PURPLE='\[\e[1;35m\]' | |
# Get the name of the branch we are on | |
git_prompt_info() { | |
branch_prompt=$(__git_ps1) | |
if [ -n "$branch_prompt" ]; then | |
status_icon=$(git_status) | |
echo $branch_prompt $status_icon | |
fi | |
} | |
# Show character if changes are pending | |
git_status() { | |
if current_git_status=$(git status | grep 'added to commit' 2> /dev/null); then | |
echo "☠" | |
fi | |
} | |
PS1='\u@\h: \w $(git_prompt_info " (%s)")\n'$COLOR_LIGHT_PURPLE'→ '$COLOR_NONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment