当前用户的配置
全局用户的配置
vim /etc/profile
vim ~/.bashrc#修改这段为:if [ "$color_prompt" = yes ]; thenPS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w$(git_branch)\[\033[00m\]\$ 'elsePS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(git_branch)\$ 'fi# 在最后加上git_branch(){branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`if [ "${branch}" != "" ]thenif [ "${branch}" = "(no branch)" ]thenbranch="(`git rev-parse --short HEAD`...)"fiecho -e " \033[1;35m{\033[1;33m$branch\033[1;35m}\033[0m " #颜色设置fi}# 执行脚本source ~/.bashrc
