Last active
December 24, 2015 15:58
-
-
Save lpiepiora/6824037 to your computer and use it in GitHub Desktop.
Display git branch in a shell
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
# See unpushed commits | |
# git log --branches --not --remotes --simplify-by-decoration --decorate --oneline | |
# Comment in the above and uncomment this below for a color prompt | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "["${ref#refs/heads/}"]" | |
} | |
GREEN="\[\033[01;32m\]" | |
YELLOW="\[\033[0;33m\]" | |
WHITE="\[\033[00m\]" | |
BLUE="\[\033[01;34m\]" | |
PS1="${debian_chroot:+($debian_chroot)}$GREEN\u@\h$YELLOW\$(parse_git_branch)$WHITE:$BLUE\w$WHITE\\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment