Smarter Git Prompt

After posting my git prompt shell snippets, someone pointed out on news.YC pointed out my daftness. All you need is the following in your .bashrc:

PS1 =
'$(git branch &>/dev/null;
    if [ $? -eq 0 ]; then
        echo "\[\033[00m\]{$(git branch | grep ^*|sed s/\*\ //)}";
    fi)\$\[\033[00m\]'

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>