參考以下鏈接:
https://gist.github.com/justintv/168835
vim ~/.bash_profile
編輯profile文件, 修改PS1
# vim ~/.bash_profile
#//在此文件中插入下面這句
export PS1="\\u@windows:\w\$(__git_ps1 '(%s)')\$ "
編輯完成保存后, 執行
source ~/.bash_profile
具體配置如下:
export PS1="\[\e[37;40m\]\[\e[32;40m\]\u\[\e[37;40m\]@\W\[\e[33;40m\]\$(__git_ps1 ['%s'])\[\e[32;40m\]\$\[\e[0m\] "