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!
Re:Command Line Feedback from RVM and Git by generalk on Tuesday August 02, 2011 @12:12PM (#2837630)
The best thing I ever did for my prompt was switch to zsh and start using oh-my-zsh[1]. Zsh itself has a handful of interesting features, but oh-my-zsh's built-in prompt theme support means I can cycle through prompts (most of which also include git or rvm info) with impunity.

[1]: https://github.com/robbyrussell/oh-my-zsh

Re:Command Line Feedback from RVM and Git by telemachos on Tuesday August 02, 2011 @01:43PM (#2837976)
I'm currently using[1] a PS1 that shows branch name, whether any files in the repo need to be staged or committed and whether the repo is behind or ahead of the remote. (Credit to Adam Vandenberg[2] and Brian Carper[3] for whatever good ideas it contains.)

Here's what it looks like: http://cl.ly/8y50

[1] https://github.com/telemachus/dotfiles/blob/master/bashrc

[2] https://github.com/adamv/dotfiles/blob/master/bashrc

[3] http://briancarper.net/blog/570/git-info-in-your-zsh-prompt

Re:Command Line Feedback from RVM and Git by glenjamin on Tuesday August 02, 2011 @11:54AM (#2837564)
My major step forward in bash prompt setup earlier this year was realising it didn't have to be a single line.

I have one info line which tells me path, user, host, git branch etc. And then the prompt sits nicely on the line below and is always at the same alignment.

http://i.imgur.com/0F6qt.png

Re:Command Line Feedback from RVM and Git by glenjamin on Tuesday August 02, 2011 @02:48PM (#2838265)
Here's the bash incantation for that:

    command_exists __git_ps1 && git="$c_vcs\$(__git_ps1)"
    PS1="\n$c_path\w$git $c_id\u@$prompt_host$c_reset"
$c_* vars are just for colour, the command_exists switch lets me use the same dotfile on boxes which don't have git installed.
Re:Command Line Feedback from RVM and Git by jkmcf on Tuesday August 02, 2011 @01:39PM (#2837967)
I use the same except my 2nd line has history id and time:

136 11:33:48 $

export PS1='\[\e[32m\]\u@\h \[\033[33m\]\w\[\033[00m\] $(__git_ps1 "(%s)") ${rvm_ruby_string}\n\# \[\033[31m\] \[\033[00m\]\t \\$ '

Re:Command Line Feedback from RVM and Git by drothlis on Tuesday August 02, 2011 @03:11PM (#2838331)
Git's own bash/zsh completion support comes with utilities for the prompt. For details see:

http://git.kernel.org/?p=git/git.git;a=blob;f=contrib/comple...

Re:Command Line Feedback from RVM and Git by callahad on Tuesday August 02, 2011 @04:44PM (#2838631)
Re:Command Line Feedback from RVM and Git by Groxx on Tuesday August 02, 2011 @04:30PM (#2838580)
* ugh * does anyone actually like that avatar animation, and the slow scrolling that results from it?

I find the comments here far more useful, and they aren't one-line commands with no explanation of the parts. Thanks for the submission, for the discussion's sake, but I'm not going back to that blog any time soon.

Re:Command Line Feedback from RVM and Git by bryckbost on Tuesday August 02, 2011 @04:52PM (#2838657)
Thanks for checking out the article.

Which browser and OS are you using? Scrolling isn't slow in webkit for myself, but I'd be happy to dig in and make it smoother if it's an issue.

Re:Command Line Feedback from RVM and Git by Groxx on Tuesday August 02, 2011 @09:20PM (#2839416)
Canary Chrome in OSX. It's been stuttery in every browser I've used, in multiple OSes; I've been on the site a couple times in the past for other posts (I think most via HN). To clarify: it doesn't crawl, but it's not smooth.

Looking at the profiler in Chrome, I'm not seeing any unnecessary events while scrolling between things - maybe it's a transparency somewhere instead? Removing a handful I could find did speed things up, though I probably missed a few. Browsers are still lame at those, unfortunately :/

Re:Command Line Feedback from RVM and Git by bryckbost on Tuesday August 02, 2011 @11:48PM (#2839752)
Good to know. We'll work on getting it smoothed out a bit.
Re:Command Line Feedback from RVM and Git by SingAlong on Tuesday August 02, 2011 @12:29PM (#2837696)
My PS1 looks like this:

1.9.2@rails31::project(branch)⚡

Shows the ruby version, rvm gemset, working directory and git branch, followed by a thunderbolt prompt. This is how I set it https://gist.github.com/1120566

Re:Command Line Feedback from RVM and Git by jsjohns2 on Tuesday August 02, 2011 @04:13PM (#2838522)
The best part is the blog's un-resizable 425px column of text, containing 150+ character shell commands.
Re:Command Line Feedback from RVM and Git by bryckbost on Tuesday August 02, 2011 @04:56PM (#2838671)
We've wanted to make that better, just haven't found the time. Scrollbars seemed good enough for the interim.
Re:Command Line Feedback from RVM and Git by swah on Tuesday August 02, 2011 @01:04PM (#2837823)
Unfortunately that makes bash kinda slow for me.