Last active
August 29, 2015 14:04
-
-
Save gangelo/89fad678eed0a25c6a3f to your computer and use it in GitHub Desktop.
Git ~/.bash_profile prompt
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
| # Warning: This is NOT a replacement for your current ~/.bash_profile file. The below script | |
| # is meant to be added to the bottom of your current ~/.bash_profile file. | |
| # | |
| # APPEND (do not replace!) the below script to your current ~/.bash_profile file. | |
| # | |
| # | |
| # Requirements | |
| # | |
| # This script requires ~/.git-prompt.sh. If you DO NOT HAVE ~/.git-prompt.sh on your | |
| # machine, get it using curl. Cut & paste this into a terminal window to curl it | |
| # (but make sure you remove the '#' before running it :): | |
| # | |
| # curl -o ~/.git-prompt.sh \ | |
| # https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh | |
| # | |
| # Git prompt. | |
| source ~/.git-prompt.sh | |
| function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
| } | |
| # Skull and Crossbones Prompt | |
| export PS1='\[\033[0;32m\]\h:\[\033[m\]\[\033[36m\]\u:\[\033[m\] \[\033[1;33m\]\w\[\033[m\] $(__git_ps1 "\[\e[0;32m\](%s\[\e[0m\]\[\e[0;33m\]$(parse_git_dirty)\[\e[0m\])") \[\033[1;31m\]☠\[\033[m\] \[\e[0m\]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment