I'm having this command to set prompt in Bash terminal with Git branch name:
export PS1="\w $(git branch | grep '*') "
It shows the correct Git branch name for the first time after running the export
command above. However, when checking out another Git branch, the prompt doesn't change to show new Git branch name.
I guess the subbash command $(...) is executed only once, how to make it run every time the prompt is shown after pressing Enter?