News for hackers. Stuff that matters.
Re:Command Line Feedback from RVM and Git by SeoxyS on Tuesday August 02, 2011 @11:45AM (#2837526)
Here's my PS1:

    # -----------------------------------------------------------------
    # BASH PROMPT
    # -----------------------------------------------------------------
    
    parse_git_branch() {
        git_branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
        if [ $git_branch ]; then
            echo "•$git_branch"
        fi
    }
    
    # sexy prompt
    export PS1='[\[\033[0;35m\]\h\[\033[0;36m\] \w\[\033[00m\]\[\033[33m\]$(parse_git_branch)\[\03    3[00m\]]\$ '
And here's what it looks like:

http://akhun.com/seo/skitch/Screen_Shot_2011-08-02_at_8.47.1...

Re:Command Line Feedback from RVM and Git by Groxx on Tuesday August 02, 2011 @03:41PM (#2838436)
I'm using something similar, but ran into a problem recently: go into a detached head mode (`git checkout HEAD^`). ALL your branches (local and remote) are spat out into your PS1. It's rare enough that I haven't looked into fixing it, but have any suggestions?
Re:Command Line Feedback from RVM and Git by telemachos on Tuesday August 02, 2011 @04:53PM (#2838661)
My suggestion is to use something more like this (provided by Git's bash-completion):

    branch=$(__git_ps1 "%s")
That doesn't have any problem with detached head: http://cl.ly/8yN8
Re:Command Line Feedback from RVM and Git by Groxx on Tuesday August 02, 2011 @09:00PM (#2839364)
ooh, very nice. Prior to this & your other reply, I hadn't seen anything using the __git functions. Everyone uses sed. Thanks!