-
-
Save gianick/8eb5a586d1fbb9effaaad1c05b0ee8b9 to your computer and use it in GitHub Desktop.
Git repository status in your ubuntu terminal
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
# Note: This should be placed in your .bashrc or .bash or .profile or whatever it is you use to control your | |
# terminals appearance. | |
# Reset | |
Color_Off="\[\033[0m\]" # Text Reset | |
# Regular Colors | |
Black="\[\033[0;30m\]" # Black | |
Red="\[\033[0;31m\]" # Red | |
Green="\[\033[0;32m\]" # Green | |
Yellow="\[\033[0;33m\]" # Yellow | |
Blue="\[\033[0;34m\]" # Blue | |
Purple="\[\033[0;35m\]" # Purple | |
Cyan="\[\033[0;36m\]" # Cyan | |
White="\[\033[0;37m\]" # White | |
# Bold | |
BBlack="\[\033[1;30m\]" # Black | |
BRed="\[\033[1;31m\]" # Red | |
BGreen="\[\033[1;32m\]" # Green | |
BYellow="\[\033[1;33m\]" # Yellow | |
BBlue="\[\033[1;34m\]" # Blue | |
BPurple="\[\033[1;35m\]" # Purple | |
BCyan="\[\033[1;36m\]" # Cyan | |
BWhite="\[\033[1;37m\]" # White | |
Time12h="\T" | |
Time12a="\@" | |
PathShort="\W" | |
PathFull="\w" | |
NewLine="\n" | |
Jobs="\j" | |
Login="${debian_chroot:+($debian_chroot)}$Blue\u@\h$Color_Off:" | |
export PS1=$Color_Off$Login$Yellow$PathFull$Color_Off'$(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 "'$BRed'"$(__git_ps1 " [ %s ]"); \ | |
fi) '$Color_Off'\$ "; \ | |
else \ | |
# @2 - Prompt when not in GIT repo | |
echo " '$Color_Off'\$ "; \ | |
fi)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment