[Yanel-dev] showing git branch in command prompt
simon
simon at 333.ch
Wed Oct 19 12:17:23 CEST 2011
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