Last active
February 15, 2018 09:57
-
-
Save mspreij/ee30ec3e2f5d251439293189246c761c to your computer and use it in GitHub Desktop.
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
# prompt | |
export PS1="[\u@\h:\w]\[\e[1;32m\]\$(current_git_repository)\[\033[0m\]\$ " | |
# function used in prompt | |
function current_git_repository { | |
local branch=`git branch 2>/dev/null | grep ^\* | cut -b3-`; | |
local star=''; | |
if [ "$branch" != '' ]; then | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && star='*' || star=''; | |
echo "[$branch$star]" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment