jimeh/git-aware-prompt

Prompt shows wrong branch

samtstern opened this issue · 4 comments

Here's my configuration:

export PS1="\u@\h \W \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\n\$ "

Right now in my terminal I see the following prompt:

samstern@samstern-macbookpro firebase-tools (master)
$

But when I run git branch you can see I am not on master:

samstern@samstern-macbookpro firebase-tools (master)

$ git branch
  fix-firestore-delete-escaping
  master
* ss-firestore-delete-bugfix

Any idea what's going on here?

Have you also set PROMPT_COMMAND?

No I don't have that set anywhere.

PROMPT_COMMAND="find_git_branch; find_git_dirty; $PROMPT_COMMAND"

You should either source prompt.sh or add that line elsewhere. Without that, git_branch and git_dirty will probably only ever be set once.

@lethosor that seemed to work, thanks!