Displaying git branch in the bash prompt - Ubuntu

I'm looking to display my current git branch in the bash prompt.

I can come close by following these instructions, but it does not
display the branch. http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/

Would any of you happen to know how to do this?

Thank you much.

Probably best to ask on a Git list... sure lots of Rails users are Git
users, but all Git list subscribers are :slight_smile:

http://groups.google.com/group/git-users

If you are using zsh, take a look at “oh my zsh” : https://github.com/robbyrussell/oh-my-zsh

What does "come close" mean? The above directions worked exactly
as expected for me on OS X (10.6.6).

I should have been clearer.

The time displays, as does the working directory. They are also both color-coded. However, the current branch does not show (as I did initially mention).

I’m not on OS X but instead Ubuntu 10.04.

Yes, I missed that, as the subject line was truncated - perhaps
better to put it in the email body :slight_smile:

On OS X:

07:02 ~ $ cd projects/current
07:02 ~/projects/current (user_customer)$ git-symbolic-ref
usage: git-symbolic-ref [-q] [-m <reason>] name [ref]
07:06 ~/projects/current (user_customer)$

On Ubuntu 10.4
07:05 ~/projects/testcase $ git branch
* master
07:05 ~/projects/testcase $ git-symbolic-ref
git-symbolic-ref: command not found
07:05 ~/projects/testcase $

That would seem to be the main problem. Anyway, this probably is
OT here, but feel free to send follow-up questions to me directly :slight_smile:

Excerpts from dana tassler's message of Sun Feb 27 17:37:20 -0800 2011:

I'm looking to display my current git branch in the bash prompt.

I can come close by following these instructions, but it does not
display the branch. http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/

Would any of you happen to know how to do this?

The above tries to run git-symbolic-ref. On Ubuntu you'd want git symbolic-ref
(i.e. without the first -).

David, that was IT! Thank you very much.

Works beautifully now.