Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- git_branch() {
- branch=
- gitlabel="git."
- if [ -d .git ]; then
- status=$(git status 2> /dev/null)
- branch="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')"
- if [ "$( echo $status | grep "branch is ahead")" ]; then
- branch="$branch*"
- fi
- if [ "$( echo $status | grep "working tree clean")" ]; then
- branch="$gitlabel\033[32m$branch\033[m"
- else
- branch="$gitlabel\033[93m$branch\033[m";
- fi
- fi
- if ! [ -z "$branch" ]; then echo -e " $branch"; fi
- }
- PS1="\W\$(git_branch) $ "
Add Comment
Please, Sign In to add comment