Created
October 3, 2013 08:25
-
-
Save pepl/6806879 to your computer and use it in GitHub Desktop.
.bashrc git branch
This file contains 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
parse_git_branch() { | |
git branch 2> /dev/null | perl -lanE 'if (/^\* (.*)/) { $b=$1; $b=~s/^(.{20}).+/$1.../; say "[$b]"; }' | |
} | |
export PS1='\[\e[32;1m\]\u@${debian_chroot:+($debian_chroot)}\h\[\e[0m\]:\[\e[36;1m\]\w\[\e[0m\]\[\e[31;1m\]$(parse_git_branch)\[\e[0m\]$ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment