DEV Community

Discussion on: How to add git branch name to shell prompt in Ubuntu

Collapse
 
edgarvazquez43 profile image
edgarVazquez43 • Edited

Maybe it help you, add these lines to .bashrc :

# Colors definition
BLUE='\e[94m'
L_BLUE='\e[96m'
YELLOW='\e[93m'
GREEN='\e[32m'
L_GREEN='\e[92m'
RED='\e[31m'
L_RED='\e[91m'
NC='\e[0m'

export GIT_PS1_SHOWDIRTYSTATE=true        # show * for changes
export GIT_PS1_SHOWUNTRACKEDFILES=true    # show % for new files
export PS1="$GREEN\u$YELLOW@$L_GREEN\h$YELLOW: $BLUE\W $L_RED\$(__git_ps1)$NC $ "
Enter fullscreen mode Exit fullscreen mode