I got to display just the branch name in the PS1 if I am in a git repo linux PS1 - display branch name only inside a git repo, but I am not able to get it integrated with my earlier PS1, which is
PS1="[\D{%F} \@] \u /\W $ "
this displays, datetime + username
[2015-08-20 11:38 PM] mtk
I tried
PS1="[\D{%F} \@] \u /\W $(__git_ps1) $ "
but, i get error
__git_ps1: command not found
<empty PS1>
Any way to get git branch name along with earlier details that my PS1 used to output?
EDIT: I also tried
PS1="[\D{%F} \@] \u /\W '$(__git_ps1)' $ "
but, this gives empty quotes always, even inside a git repo.
The question is different from that one. I was to display time and date + git branch (if its inside a repo).