[Yanel-dev] showing git branch in command prompt

Michael Wechner michael.wechner at wyona.com
Wed Oct 19 13:55:41 CEST 2011


Hi Simon

Sorry to hear that you had trouble with the "git console code", but I 
think it would be good to figure out
what the real problem is that this code seems to cause.

Can you post the hints of th" xorg errors"?

Thanks

Michael

Am 19.10.11 12:17, schrieb simon:
> hi all
>
> after adding this lines to my .profile everything looked good. but 
> when i restarted my computer i could not login anymore. it just throw 
> me back to the login screen. after searching a solution for this 
> problem for a long long time i gave up and installed the system new. 
> everything worked fine. after a while i had the same problem again. 
> finally i found a hint in the xorg errors which pointed to the lines 
> of this script. after removing it i could login again.
>
> so this f*** lines cost me really a lot of time and nerves.
>
> hope this helps others to avoid such problems.
>
> cheers
> simon
>
> Am 30.09.2011 14:28, schrieb Michael Wechner:
>> Hi
>>
>> A friend of mine pointed out me how to show the git branch in the 
>> command prompt:
>>
>> https://duckduckgo.com/?q=show+git+branch+command+prompt
>>
>> whereas I am currently doing it as follows on a Mac. Add the 
>> following lines to /Users/MY_NAME/.profile
>>
>> function parse_git_branch () {
>>        git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ 
>> (\1)/'
>> }
>>
>> RED="\[\033[0;31m\]"
>> YELLOW="\[\033[0;33m\]"
>> GREEN="\[\033[0;32m\]"
>> NO_COLOUR="\[\033[0m\]"
>>
>> PS1="$GREEN\u at macbook$NO_COLOUR:\w$YELLOW\$(parse_git_branch)$NO_COLOUR\$ 
>> "
>>
>> and start a new terminal window and then you should see something like:
>>
>> michaelwechner at macbook:~/src/yanel (master)$
>>
>> which is more convenient than typing "git branch" ;-)
>>
>> HTH
>>
>> Michael
>>
>



More information about the Yanel-development mailing list