git - __git_ps1 shows wrong branch -
i'm getting issue __git_ps1 script returns wrong branch.
first, i'll check branches:
ssalisbury@dotweb ssalisbury (master)$ git branch -a * master remotes/origin/head -> origin/master remotes/origin/master
then i'll create , checkout new branch, , __git_ps1 script still show i'm on original branch:
ssalisbury@dotweb ssalisbury (master)$ git checkout -b newbranch switched new branch 'newbranch' ssalisbury@dotweb ssalisbury (master)$ git branch -a master * newbranch remotes/origin/head -> origin/master remotes/origin/master ssalisbury@dotweb ssalisbury (master)$
i've been able determine it's showing branch repository on same machine has checked out, although can't figure out why. how can make sure it's displaying information repository i'm in?
my ps1 following:
\[\e[1;32m\]\u\[\e[0;33m\]@\h \[\e[1;36m\]\w\[\e[1;33m\]$(__git_ps1 " (%s)")\[\e[1;32m\]\$ \[\e[0m\]
the ps1 string created login script. here relevant lines script:
bgreen='\e[1;32m' # green yellow='\e[0;33m' # yellow bcyan='\e[1;36m' # cyan byellow='\e[1;33m' # yellow bgreen='\e[1;32m' # green color_off='\e[0m' # text reset export ps1='\['$bgreen'\]\u''\['$yellow'\]@\h ''\['$bcyan'\]\w''\['$byellow'\]$(__git_ps1 " (%s)")''\['$bgreen'\]\$ ''\['$color_off'\]'
the issue had aliased test
change directories other repository. had forgotten test
command-line utility , __git_ps1 uses it. when __git_ps1 trying use test
instead changing directories other repository.
the problem fixed removing alias.
Comments
Post a Comment