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.

On 28 February 2011 01:37, dana tassler [email protected] wrote:

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

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

On 28 February 2011 02:37, dana tassler [email protected] wrote:

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

If you are using zsh, take a look at “oh my zsh” :

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.

On Mon, Feb 28, 2011 at 8:53 AM, Hassan S. <
[email protected]> wrote:

For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

“One way is to make it so simple that there are obviously no
deficiencies
and the other way is to make it so complicated that there are no obvious
deficiencies.”

  • C.A.R. Hoare, in talking about designing software.

On Sun, Feb 27, 2011 at 5:37 PM, dana tassler [email protected]
wrote:

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.
Bedazzle Your Bash Prompt with Git Info // RailsTips by John Nunemaker

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


Hassan S. ------------------------ [email protected]
twitter: @hassan

On Mon, Feb 28, 2011 at 6:57 AM, dana tassler [email protected]
wrote:

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 ] 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:


Hassan S. ------------------------ [email protected]
twitter: @hassan

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.
Bedazzle Your Bash Prompt with Git Info // RailsTips by John Nunemaker

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 -).


med vnlig hlsning
David J. Hamilton

David, that was IT! Thank you very much.

Works beautifully now.

On Mon, Feb 28, 2011 at 10:54 AM, David J. Hamilton
[email protected]wrote:

symbolic-ref
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

“One way is to make it so simple that there are obviously no
deficiencies
and the other way is to make it so complicated that there are no obvious
deficiencies.”

  • C.A.R. Hoare, in talking about designing software.