Created
September 25, 2014 14:56
-
-
Save dmitrinesterenko/273b879db94e32f79e0e to your computer and use it in GitHub Desktop.
Shell addition to show current git branch
This file contains hidden or 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
#find the current git branch (this could be done differently through git status) | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
GREEN="\[\033[0;32m\]" | |
WHITE="\[\e[1;0m\]" | |
#update the shell prompt line | |
PS1="$WHITE\$(date +%H:%M) \w$GREEN \$(parse_git_branch)$WHITE\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment