答案1
如果你有bash 完成您可以添加$(__git_ps1)
,如果您使用,"
则需要逃避命令替换。
# change these if you don't dig my colors!
NM="\[\033[0;1;37m\]" #means no background and white lines
HI="\[\033[0;37m\]" #change this for letter colors
SI="\[\033[38;5;202m\]" #this is for the current directory
GI="\[\033[38;5;220m\]" # Git branch color
NI="\[\033[0;1;30m\]" #for @ symbol
IN="\[\033[0m\]"
PS1="${NM}[${HI}\u${NI}@${HI}\h ${SI}\w\$(__git_ps1 ' ${NM}(${GI}%s${NM})')${NM}]: ${IN}"