Skip to content

Instantly share code, notes, and snippets.

@rpanachi
Created November 27, 2009 15:54
Show Gist options
  • Save rpanachi/244079 to your computer and use it in GitHub Desktop.
Save rpanachi/244079 to your computer and use it in GitHub Desktop.
Display the git branch on terminal
#include on ~/.bashrc
PS1="\[\033[38m\]\u";
PS1="$PS1\[\033[32m\] \w";
PS1="$PS1\[\033[31m\]";
PS1="$PS1\`git branch 2>/dev/null | grep \"^\*\" | \\
sed -r \"s/\*\ (.*)/ \(\1\)/\"\`";
export PS1="$PS1\[\033[37m\]$\[\033[00m\]";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment