Currently my Windows Git Bash shell prompt looks like this:
UserName@ComputerName Path (Branch)
When I echo $PS1
, I get:
\[\033]0;$MSYSTEM:\w\007\]\n\[\033[32m\]\u@\h \[\033[33m\]\w$(__git_ps1)\[\033[0m\]\n$
In my .bashrc
file I tried to update this like so:
PS1="\[\033[32m\]\w$(__git_ps1)\[\033[0m\]\n$"
What happens is that I lose the UserName@ComputerName
which is what was intended. However for some reason, the $(__git_ps1)
also disappeared.
When I however do it like this: PS1=${PS1:46}
it works as expected.
My plan was to add some additional changes (replace a fixed path with nothing) so the substring method is less then optimal.
What's going on?
UPDATE:
When I execute the PS1="\[\033[33m\]\w$(__git_ps1)\[\033[0m\]\n$"
in the shell directly, it also works as expected.