Created
September 7, 2012 16:58
-
-
Save hsanchez/3667771 to your computer and use it in GitHub Desktop.
Colored Git Status in your command line
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
## place this in your .profile | |
## For example, | |
## ☺ is a clean repository. | |
## o_O means there are changes. | |
## O_o means there are staged but not commit changes. | |
## ☼ means nothing to show for | |
function parse_git_dirty { | |
D="$(git status 2> /dev/null | tail -n1 | awk '{ print $1 }' )" | |
if [ "$D" = "nothing" ] ; then | |
echo -e "☺ : " | |
elif [ "$D" = "no" ]; then | |
echo -e "o_O : " | |
elif [ "$D" = "#" ]; then | |
#echo -e "\_/||| \033[0;37m: " | |
echo -e "O_o : " | |
else | |
echo "☼ " | |
fi | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/" | |
} | |
export PS1="(@ \W) What now mate? \[\033[1;32m\]\$(parse_git_dirty)\$(parse_git_branch) \[\033[0m\]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment