I'd like to add git branch name to the terminal prompt string.
user@machine_name ~/workingdirectory (git_branch_name) $
I've tried pasting this code into the bashrc file:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\>>>>[\033[00m\] $ "
However, this code overrides pantheon-terminal's default styling, which I want to keep.
Is there a way I can add the git branch name to the prompt string without overriding the default pantheon-terminal prompt string styling?