Created
January 27, 2015 13:51
-
-
Save PMTM/9ed56606b1f748d9a857 to your computer and use it in GitHub Desktop.
GIT state prompt
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 PS1=\\u@\\h:$IBlack$Time12h$Color_Off'$(if [[ ${PWD} == _puth_here_git_active_path_* ]]; then \ | |
git branch &>/dev/null;\ | |
if [ $? -eq 0 ]; then \ | |
echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \ | |
if [ "$?" -eq "0" ]; then \ | |
# @4 - Clean repository - nothing to commit | |
echo "'$Green'"$(__git_ps1 " (%s)"); \ | |
else \ | |
# @5 - Changes to working tree | |
echo "'$IRed'"$(__git_ps1 " {%s}"); \ | |
fi) '$BYellow$PathShort$Color_Off'\$ "; \ | |
else \ | |
# @2 - Prompt when not in GIT repo | |
echo " '$Yellow$PathShort$Color_Off'\$ "; \ | |
fi \ | |
else \ | |
echo " '$Yellow$PathShort$Color_Off'\$ "; \ | |
fi)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment