Last active
August 29, 2015 14:05
-
-
Save Linusp/5f6f47b33c27161a287c to your computer and use it in GitHub Desktop.
Show git branch by PS1
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
CC_RESET='[00m' | |
CC_WHITE='[1;37m' | |
CC_LIGHT_BLUE='[1;34m' | |
CC_LIGHT_GREEN='[1;32m' | |
CC_LIGHT_RED='[1;31m' | |
function get_git_repos_branch() | |
{ | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/" | |
} | |
PS1='\[\e${CC_WHITE}\][\[\e${CC_RESET}\]\ | |
\[\e${CC_LIGHT_BLUE}\]\w\[\e${CC_RESET}\]\ | |
\[\e${CC_WHITE}\]]\[\e${CC_RESET}\]\ | |
\[\e${CC_LIGHT_BLUE}\]$(get_git_repos_branch)\[\e${CC_RESET}\]\n\ | |
\[\e${CC_LIGHT_GREEN}\]\u \[\e${CC_RESET}\]\ | |
\[\e${CC_LIGHT_RED}\]\$\[\e${CC_RESET}\] ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment