# Customize BASH PS1 prompt to show current GIT repository and branch. # Though this file has been made for ATILLA servers, some of its contents are inspired from # Mike Stewart's website : http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt Reset="\033[0m" Green="\033[0;32m" BIRed="\033[1;91m" function BranchIndicator { # Check if the current folder has a git repository git branch &>/dev/null if [ "$?" -eq 0 ]; then # Check the repo status echo `git status` | grep "nothing to commit" > /dev/null 2>&1 if [ "$?" -eq 0 ]; then echo -e $Green$(__git_ps1 " (%s)")$Reset" "; else echo -e $BIRed$(__git_ps1 " (%s)")$Reset" "; fi else echo " " fi } export PS1='\[\033[01;33m\]\H \[\033[01;34m\]\w\[\033[00m\]$(BranchIndicator)\[\033[01;33m\]\$\[\033[00m\] '