Re: git-PS1 bash prompt setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shawn Pearce wrote:

> Sean <seanlkml@xxxxxxxxxxxx> wrote:
>> On Sun, 26 Nov 2006 15:27:07 +0100 (CET)
>> Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
>> 
>>> But there really is no good place to put it: most commands need a git 
>>> repository, and those which do not, are inappropriate to put an option 
>>> "--show-ps1" into. Except maybe repo-config. Thoughts?
>> 
>> What about just making it an option to the git wrapper?
> 
> I'm using something like this, and will be adding it to
> git-completion.bash tonight:
> 
>       __git_ps1 ()
>       {
>               local b="$(git symbolic-ref HEAD 2>/dev/null)"
>               if [ -n "$b" ]; then echo "(${b##refs/heads/})"; fi
>       }
>       PS1='[\u@\h \W$(__git_ps1)]\$ '
> 
> it works very well...

Perhaps, as it was proposed somewhere else in this thread, instead of
\u@\h use $(git repo-config --get user.email)?

And I would add \!: at the beginning of prompt, but that might be
just me.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]