Add GIT branch to terminal prompt, works in your IDE also (PHPSTORM)

# Git branch in prompt.

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'

export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "

So open ~/.bash_profile in your favorite editor and add the above content to the bottom.

If you are using an existing Terminal session, don't forget to make the changes take effect by sourcing the file with the command source ~/.bash_profile or open a new terminal window. From there on you will have current branch name in your prompt.