sixforone 2020-06-12
1.进入你的home
目录
cd ~
2.编辑.bashrc
文件
vi .bashrc
3. 将下面的代码加入到文件的最后处
function git_branch { branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`" if [ "${branch}" != "" ];then if [ "${branch}" = "(no branch)" ];then branch="(`git rev-parse --short HEAD`...)" fi echo " ($branch)" fi } export PS1=‘\\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ ‘
4.保存退出
5.执行加载命令
source ./.bashrc