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)>”

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} ”



Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.