I'm getting an issue where the __git_ps1 script returns the wrong branch.
First, I'll check my branches:
ssalisbury@DOTWeb ssalisbury (master)$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Then I'll create and checkout a new branch, and the __git_ps1 script will still show that I'm on my original branch:
ssalisbury@DOTWeb ssalisbury (master)$ git checkout -b newBranch
Switched to a 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 to determine that it's showing what branch another repository on the same machine has checked out, although I can't figure out why. How can I make sure that it's displaying the information for the repository I'm in?
My PS1 is the 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 is created by a login script. Here are the relevant lines from that 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'\]'