Right now, my shell is set to display export PS1="\t \w $ "
Is there any way make prompt dynamic, always reevaluating it’s current location and format to the following rules:
1. When inside directory that contains git repo, it changes to include branch i am on
19:42:07 (dev) ~ $
19:42:07 (release) ~ $
1.1 Can branch be shown in different color then the rest of the prompt?
2. When outside of the directory that contains git repo, it stays as is
19:42:07 ~ $
The Git distribution contains a
contrib/completion/git-completion.bashfile which does this, and much more besides. The file itself contains installation instructions.