Last active
December 16, 2015 18:09
-
-
Save PatrickJS/5475827 to your computer and use it in GitHub Desktop.
Bash Profile
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
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "git:("${ref#refs/heads/}$(num_git_commits_ahead)")" | |
} | |
function num_git_commits_ahead { | |
num=$(git status 2> /dev/null \ | |
| grep "Your branch is ahead of" \ | |
| awk '{split($0,a," "); print a[9];}' 2> /dev/null) || return | |
if [[ "$num" != "" ]]; then | |
echo "+$num" | |
fi | |
} | |
function path(){ | |
old=$IFS | |
IFS=: | |
printf "%s\n" $PATH | |
IFS=$old | |
} | |
export PATH="~/bin:$PATH" | |
export EDITOR='subl -w' | |
export PS1="\e[1;32m\$(parse_git_branch)\e[m\n\u@\h:\w \$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment