add this code to ~/.bashrc file

# git branch in prompt

function parse_git_branch {
git branch –no-color 2> /dev/null | sed -e ‘/^[^*]/d’ -e ‘s/* \(.*\)/\1/’
}

function parse_git_dirty {
git diff –quiet || echo “⚡”
}

function parse_git {
local branch=$(parse_git_branch)
if [[ -n “$branch” ]]; then
echo ” <$branch$(parse_git_dirty)>”
fi
}

function prompt {
local LIGHT_RED=”\[33[1;31m\]”
local NORMAL=”\[33[00m\]”
local BOLD=”\[33[1m\]”
local OFF=”\[33[m\]”

PS1=’${debian_chroot:+($debian_chroot)}\[33[01;32m\]\u@\h\[33[00m\]:\[33[01;34m\]\w\[33[00m\]\[33[1;31m\]$(parse_git)\[33[m\]\$ ‘
PS2=”${BOLD}>>${OFF} ”
}

prompt

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s