环境: fedora 20
$ curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh ############################## 以下内容放入 ~/.bashrc ################################ source ~/.git-prompt.sh # Bash completion if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi export GIT_PS1_SHOWDIRTYSTATE=1 export PS1='[ 33[01;32m]u@h[ 33[01;34m] w[ 33[01;33m]$(__git_ps1)[ 33[01;34m] $[ 33[00m] ' ################################################################### $ source ~/.bashrc