Skip to content

Instantly share code, notes, and snippets.

@drgarcia1986
Created January 18, 2015 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drgarcia1986/9436691776f74c28e0c9 to your computer and use it in GitHub Desktop.
Save drgarcia1986/9436691776f74c28e0c9 to your computer and use it in GitHub Desktop.
Add Git Branch Name to Terminal Prompt (ubuntu)
# Import Git script for PS1
source /etc/bash_completion.d/git-prompt
# Color definition for PS1
txtred='\e[0;31m'
txtwhite='\e[0;37m'
txtyellow='\e[0;33m'
# Defnite PS1 in this format:
# user:dir (git branch)$:
# on this colors:
# user = white
# dir = yellow
# branch = red
# $ = white
PS1="\[$txtwhite\]\u:\[\e[0m\]\[$txtyellow\]\w\[\e[0m\]\[$txtred\]\$(__git_ps1)\[\e[0m\]\[$txtwhite\]\\$\[\e[0m\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment