On Monday 09 February 2015 11:42:56 Ladislav Slezak wrote:
> Do you use Git? :-))
> 
> Have you ever committed a change into a wrong branch? Have you ever started
> working on a feature/bug fix without pulling from remote and thus need to
> rebase and resolve the conflicts later? Have you ever forgotten your
> stashed changes?
> 
> If yes, then continue reading at
> http://lslezak.blogspot.cz/2015/02/git-status-in-bash-prompt-bash-git.html


Or you could use the stuff that we already ship   ;)

cat >> ~/.bashrc <<EOF
export PS1='[\u@\h]\w$(__git_ps1 " (%s)")> '
EOF


Or use it with custom colors:
# colors
_bbold="$(path tput bold 2> /dev/null;)"
_bred="$(path tput setaf 1 2> /dev/null)"
_bgreen="$(path tput setaf 2 2> /dev/null)"
_blgrey="$(path tput setaf 7 2> /dev/null)"
_blblue="$(path tput setaf 6 2> /dev/null)"
_sgr0="$(path tput sgr0 2> /dev/null)"

# for xterm:
# export PS1='$(ppwd \l)\u@\h:\w$(__git_ps1 " (%s)")> '
export PS1='\[$_blgrey\]\u@\h\[$_sgr0\] \w\[$_bgreen\]$(__git_ps1 " 
(%s)")\[$_sgr0\]> '


FYI: This magic comes from:
/etc/bash_completion.d/git-prompt.sh

Ciao,
   Daniel

-- 
J. Daniel Schmidt <[email protected]>         SUSE LINUX GmbH
Research & Development                   Maxfeldstr. 5
HRB 21284 (AG Nürnberg)                  D-90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham 
Norton

--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to