$ chmod +x ~/.git-prompt.sh
$ chmod +x ~/.git-completion.bash
$ atom ~/.bash_profile
编辑.bash_profile, 加入如下文本:
# Git configuration
# Branch name in prompt
source ~/.git-prompt.sh
PS1='[\W$(__git_ps1 " (%s)")]\$ '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'
# Tab completion for branch names
source ~/.git-completion.bash
激活.bash_profile文件
$ source ~/.bash_profile
Make your hands dirty!