We want our prompts to look like this:
[ddemaree@ddemaree-osx giftboxapp (master)]$ In this example, the text inside the square brackets shows the current username and hostname (ddemaree@ddemaree-osx), followed by the name of the current directory (giftboxapp), and finally the current Git branch ((master)) shown in parentheses.
If we have untracked changes to this Git project, those are denoted with an asterisk:
[ddemaree@ddemaree-osx giftboxapp (master *)]$ The Git team maintains a shell add-on called git-prompt.sh, as part of the core Git package. It adds a shell function called __git_ps1 that outputs prompt-friendly status information about the current repository.
ddemaree-osx:~ ddemaree$ ddemaree-osx:~ ddemaree$ curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > ~/.git-prompt.sh